Setting index.html as default page in asp.net core

后端 未结 8 538
北荒
北荒 2020-12-30 19:17

How can I get asp.net core to serve an index.html file from inside my wwwroot?

The reason I want to do this is because I an developing an angular 4 app using the ang

相关标签:
8条回答
  • 2020-12-30 19:58

    Just use this in startup.cs:

    app.UseFileServer();
    

    It's shorthand for:

    app.UseDefaultFiles();
    app.UseStaticFiles();
    

    it avoids issues with having to have those in the correct order (as shown above)

    0 讨论(0)
  • 2020-12-30 19:59

    I needed to declare UseDefaultFiles() before UseStaticFiles().

    app.UseDefaultFiles();
    app.UseStaticFiles();
    
    0 讨论(0)
提交回复
热议问题