Aspnet core 2.2 default route changed to "~/index.html" after installing Swashbuckle.AspNetCore package
Asked Answered
A

1

5

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?

Appassionato answered 30/1, 2019 at 20:1 Comment(1)
Swagger has an index.html file but it's under the swagger virtual directory. However, if you have a physical index.html file in your project root, that will always take precedence over anything else.Allout
L
11

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.

League answered 24/5, 2019 at 2:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.