public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseWebRoot("myroot") // name it whatever you want
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
对这种变化有任何副作用吗?
以下是我能想到的三个:
Bower 包管理器无法正常工作,因为它在wwwroot中查找lib文件夹。我不确定这是否可配置。
您需要修复bundleconfig.json以查看新目录。
您需要更新project.json中的include部分,以在发布输出中包含新目录。
2
使用 Asp.Net Core 2.2 我这样做了:在Setup.cs的Configure方法中我改变了
app.UseStaticFiles();
至
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(Path.Combine(
AppDomain.CurrentDomain.BaseDirectory,
"myStaticFolder")),
});
2 回答
是。在
Program
类中添加UseWebRoot
调用:以下是我能想到的三个:
Bower 包管理器无法正常工作,因为它在
wwwroot
中查找lib
文件夹。我不确定这是否可配置。您需要修复
bundleconfig.json
以查看新目录。您需要更新
project.json
中的include
部分,以在发布输出中包含新目录。使用 Asp.Net Core 2.2 我这样做了:在
Setup.cs
的Configure
方法中我改变了至
参考/来源和英文这里