When i start a project (.Net Core MVC), Index.chtml opens as usual. How to open Swagger interface by default.
I have default route like this:
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
There's several ways you could achieve this:
You can achieve this using couple of ways:
launchsettings.json
file and change the value of the applicationUrl
parameter to swagger url.Or
routes.MapHttpRoute(
name: "swagger_root",
routeTemplate: "",
defaults: null,
constraints: null,
handler: new RedirectHandler((message => message.RequestUri.ToString()), "swagger"));
Or
Launch browser
in project properties, Debug tab:If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With