System.ArgumentException A route named X is already in the route collection.
Environment
Product | Progress® Telerik® Reporting |
Project Type | ASP.NET MVC |
Description
The following error occurs at the following line:
Telerik.Reporting.Services.WebApi.ReportsControllerConfiguration.RegisterRoutes(config);
Error Message
System.ArgumentException: 'A route named 'X' is already in the route collection. Route names must be unique.
Parameter name: name'
Cause/Possible Causes
The most common reasons are renaming the project files or having duplicate using of Telerik.Reporting.Services.WebApi.ReportsControllerConfiguration.RegisterRoutes(config).
Solution
-
In case of experiencing the issue locally
- Delete the project's bin directory and then clean and rebuild the solution. Here, you can find more suggestions related to this Rest API error: A route named “x” is already in the route collection. Route names must be unique. Exception with ASP.NET MVC 3.
- Check if there is only one routes registering. For example in the Application_Start() method of Global.asax.cs.
-
In case of publishing the application to Azure environment
- On the Visual Studio publish screen go to Settings
- Expand File Publish Options
- Tick the 'Remove additional files at destination' checkbox.
For more information, check Azure deployment: A route named 'HelpPage_Default' is already in the route collection. Route names must be unique. Parameter name: name stackoverflow thread.