I am developing a WEB API in .NET, and I want to document this with swagger. My default route is:
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
);
But it is giving me this error when I try to access localhost:55800/swagger:
{
"$id": "1",
"message": "No HTTP resource was found that matches the request URI 'http://localhost:55800/swagger/ui/index'.",
"messageDetail": "No type was found that matches the controller named 'swagger'."
}
I've changed the swagger's route with this command:
config.EnableSwaggerUi("apihelp/{*assetPath}", c =>
... // following lines omitted
But I still cannot remove "api" prefix from my routeTemplate in the MapHttpRoute method.
How can I make it recognize the route without this "api" prefix on MapHttpRoute?