Aspnet core 2.2 default route changed to “~/index.html” after installing Swashbuckle.AspNetCore package

ぃ、小莉子 提交于 2021-02-11 09:39:39

问题


After installing the Swashbuckle.AspNetCore in my Asp.net Core (MVC) application the default route is override with "index.html" page.

Where ever I used "~/" now is redirecting my application to "~/index.html" instead of default MVC route.

How i can fix this?


回答1:


I had encountered this issue after setting the route prefix of swagger to root i.e.

app.UseSwaggerUI(c =>
{
    c.SwaggerEndpoint("/swagger/v1/swagger.json", "LMW Valuer API V1");
    c.RoutePrefix = string.Empty;
});

Even after removing the route prefix, I was still being redirected to index.html.

To solve my issue I has to clear the browser cache for my site.

Hope this helps.



来源:https://stackoverflow.com/questions/54448639/aspnet-core-2-2-default-route-changed-to-index-html-after-installing-swashbu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!