Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A route named 'DefaultRoute' is already in the route collection. Route names must be unique

When I publish an ASP.NET WebAPI solution to a remote IIS Server, I get the error message:

Message: System.ArgumentException: A route named 'DefaultRoute' is already in the route collection. Route names must be unique.

I saw this thread with the same problem, but nothing on it has worked. I have tried:

  1. Deleting all bin/obj folders in all projects.
  2. Cleaning/Rebuilding
  3. Deleting files off the the remote server before publishing
  4. Renaming the project

Is there anyway I can find out if there is a stale file. I did rename some files and I heard that this can cause a problem?

Not sure if this matters, but I am using the ASP.NET WebApi along with RestSharp to make my rest calls.

This is what my Global.asax startup has: Is it redundant?

AreaRegistration.RegisterAllAreas();
WebApiConfig.Register(GlobalConfiguration.Configuration);
RouteConfig.RegisterRoutes(RouteTable.Routes);
like image 378
xaisoft Avatar asked Jan 28 '15 14:01

xaisoft


Video Answer


1 Answers

I came to similar problem with already set routes. For me the solution was here: https://stackoverflow.com/a/28503674/1496138 . Problem was I later renamed project file - old DLL files with previous name still existed in the /bin directory and automatic startup configuration run them too.

like image 99
Kraken101 Avatar answered Nov 14 '22 22:11

Kraken101