首先 publish,dotnet xxx.dll 要在 dll所在目录 着实不方便
我已经改成 配置的了
app.UseDefaultFiles
(
new DefaultFilesOptions()
{
DefaultFileNames =
{
"index.html"
}
}
);
//兼容 Linux/Windows wwwroot 路径配置
var wwwroot = GetExistsPaths
(
"wwwrootpaths.json"
, "wwwroot"
)
.FirstOrDefault();
if (wwwroot.IsNullOrEmptyOrWhiteSpace())
{
app.UseStaticFiles();
}
else
{
app
.UseStaticFiles
(
new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider
(
wwwroot
)
, RequestPath = ""
}
);
}