My .Net MVC project has the below ApiController:
But the Swagger UI generates two methods:
Observe that the ActionName TestMethod1 is omitted(probably because there is only one HttpGet in this controller)
My .Net MVC project has the below ApiController:
But the Swagger UI generates two methods:
Observe that the ActionName TestMethod1 is omitted(probably because there is only one HttpGet in this controller)
This was due to the DefaultRoute not having the {action} in the path.
routes.MapRoute(
name: "Default",
url: "{controller}/{id}",
defaults: new { controller = "Addon", action = "Index", id = UrlParameter.Optional }
);
It should be like:
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Addon", action = "Index", id = UrlParameter.Optional }
);