Reputation: 2053
I am using Swagger API Documentation Utility. Please take a look at the screenshot. The Documentation lists the methods twice. Am I missing something in order to configure this correctly?
My controller "JobTraps" is having only one method. Still it is listed two times. One without PUT
in URL and one with PUT
in URL. Same thing happens for all the other controllers.
Can someone explain to me why I am facing this behavior? What should I do in order to make it work correctly ?
Upvotes: 0
Views: 2127
Reputation: 2053
I found the issue. When i go to my webApiConfig.cs file inside App_Start folder it was having route defined twice.
So i commented out the "ActionAPI" route and now swagger started showing api listing correctly.
Hope this helps some one.
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
//config.Routes.MapHttpRoute(
// name: "ActionApi",
// routeTemplate: "api/{controller}/{action}/{id}",
// defaults: new { id = RouteParameter.Optional, action = RouteParameter.Optional }
//);
Upvotes: 4