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

后端 未结 8 680
北荒
北荒 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:49

    You are mixing both MVC and Default files serving (useDefaultFiles). Comment out the below lines from your code

    app.UseMvc(routes =>
        {
            routes.MapRoute(
                name: "default",
                template: "{controller=Home}/{action=Index}");
        });
    

    and use only app.UseDefaultFiles();. It will start working.

提交回复
热议问题