A route named “x” is already in the route collection. Route names must be unique. Exception with ASP.NET MVC 3

后端 未结 16 1907
难免孤独
难免孤独 2020-12-02 16:24

I\'m doing an ASP.NET MVC 3 web service and I keep getting this exception intermittently.

Stack trace:

Server Error in \'/\' Application.

A route n         


        
相关标签:
16条回答
  • 2020-12-02 16:41

    I am getting same error. But finally I have got solution. Scenario: I am adding different(mvc4 application) dll in my web api mvc4 application. When try to run. I am getting same error. Root Cause- When my web api application run .Application register all area from self and start loading to current application domain dll references. When application load dll(MVC4 application) that time getting error because current maproute already add key for "HelpPage_Default".

    Solution. 1.Change key for RegisterArea in maproute either current application or existing application(Refer dll). 2.Move code dll(mvc4 application) code to different liberary and refer to new dll.

    0 讨论(0)
  • 2020-12-02 16:45

    Deleting the DLLs alone didn't work for me (in VS2013), but deleting the entire 'bin' and 'obj' folders and then building the solution worked perfectly! Makes me wish I hadn't spent so long trying to fix it...

    0 讨论(0)
  • 2020-12-02 16:46

    In my case, I faced with this issue, when I added reference to another project from solution, which also was MVC and use the same names in area (I didn't want to added this project, I don't know how it happened). When I removed this DLL, project started to work.

    0 讨论(0)
  • 2020-12-02 16:46

    None of the suggestions worked for me. Went ahead and restarted the web server (IIS in this case) and that cleared the error after I had fixed the code. DLL must have been cached in IIS.

    0 讨论(0)
  • 2020-12-02 16:47

    Deleting the dlls in the bin folder did work 100%, I still had dlls my project needed to rebuild. Rather make a copy of the bin folder. then delete the original.rebuild the project. if it fails, place the missing dlls into the bin folder.

    0 讨论(0)
  • 2020-12-02 16:47

    faced this issue. the problem was occurred after adding an area to my project. there was a call for MapMvcAttributeRoutes() in RegisterArea() method. therefore, you should not look for a duplicate route names, just look for duplicate MapMvcAttributeRoutes() calls.

    0 讨论(0)
提交回复
热议问题