Until Asp.Net Core 2.1, I was using below code in order to redirect default route to swagger endpoint.
app.UseMvc(builder =>
{
builder.MapRoute("default", template: "api/{controller}/{action}/{id?}");
builder.MapGet("", context =>
{
context.Response.Redirect("./swagger/index.html", permanent: false);
return Task.FromResult(0);
});
});
However, when I upgraded to Asp.Net Core 2.2 this code did not work as expected (redirection is called)
Is this known issue? How can I solve it?
Edit: Thanks to @KirkLarkin
I have changed options.EnableEndpointRouting to false and now it is working. However as I unsderstand this is legacy routing method.
What do I need to do in order to make routing with options.EnableEndpointRouting = true;?