[英]How do I change the default path of index.html in .net core?
我使用 .net core 和 Angular Cli,所以 ngx 的默認結構是:
dist/project_name/index.html
src/index.html
等等。
我需要將默認路徑從 wwwroot 更改為
wwwroot/dist/project_name/
如何更改 .net core 中 index.html 的默認路徑?
實際上,我願意使用 .net 為 dev 和 prod 模式設置兩個路徑變量,並將其更改為與 ngx 模式 ng serve 和 ng build 一起使用。 也許你可以建議我一些最佳實踐,我該怎么做。
在啟動時的配置方法中,您可以提供像這樣的 StaticFileOptions:
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), "MyStaticFiles")),
RequestPath = "/StaticFiles"
});
進一步閱讀: https : //docs.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-2.1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.