A route named 'swagger_docs' is already in the route collection. Route names must be unique. Parameter name: name
See original GitHub issueI have a fresh install of Swashbuckle installed. It ran successfully the first time with one API controller defined and then when I added a second controller, it puked this message.
[ArgumentException: A route named 'swagger_docs' is already in the route collection. Route names must be unique.
Parameter name: name]
System.Web.Routing.RouteCollection.Add(String name, RouteBase item) +3746353
System.Web.Http.WebHost.Routing.HostedHttpRouteCollection.Add(String name, IHttpRoute route) +107
System.Web.Http.HttpRouteCollectionExtensions.MapHttpRoute(HttpRouteCollection routes, String name, String routeTemplate, Object defaults, Object constraints, HttpMessageHandler handler) +357
Swashbuckle.Application.HttpConfigurationExtensions.EnableSwagger(HttpConfiguration httpConfig, String routeTemplate, Action`1 configure) +440
Swashbuckle.Application.HttpConfigurationExtensions.EnableSwagger(HttpConfiguration httpConfig, Action`1 configure) +63
Issue Analytics
- State:
- Created 8 years ago
- Reactions:4
- Comments:30 (2 by maintainers)
Top Results From Across the Web
Why am I getting "A route named 'swagger_docs' is already ...
The error message says "A route named 'swagger_docs' is already in the route collection". How can I fix this? Microsoft Azure Collective. azure ......
Read more >System.ArgumentException A route named X is already in ...
For more information, check Azure deployment: A route named 'HelpPage_Default' is already in the route collection. Route names must be unique. Parameter name: ......
Read more >Azure API: A route named 'swagger_docs' is already in the ...
Azure API: A route named 'swagger_docs' is already in the route collection. Route names must be unique.
Read more >A route named 'HomePage' is already in the ...
A route named 'HomePage' is already in the route collection. Route names must be unique. ... Route names must be unique. Parameter name:...
Read more >A route named 'swagger_docsswagger/docs/{apiVersion}' ...
I am getting this error when I try to run an existing project that seems to be building and running just fine for...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Delete bin/obj folders worked for me.
For me the fix was simple. SwaggerConfig contains this line at the start of file
[assembly: PreApplicationStartMethod(typeof(SwaggerConfig), “Register”)]
So it automatically gets called. But I was calling Register method on demand, the old-fashioned way. Removing manual call solved the case