This has happenned before and I can't remember how I solved it. I renamed an MVC project then did a ReSharper refactor to update the namespaces. Now when I run I get the following error when I run the project:
Multiple types were found that match the controller named 'Dashboard'. This can happen if the route that services this request ('{controller}/{action}/{id}') does not specify namespaces to search for a controller that matches the request. If this is the case, register this route by calling an overload of the 'MapRoute' method that takes a 'namespaces' parameter.
The request for 'Dashboard' has found the following matching controllers:
EkmDomains.FrontEnd.Controllers.DashboardController
EkmDomains.Web.Controllers.DashboardController
开发者_运维问答
I have done a search for everywhere in the solution where the old EkmDomains.FrontEnd
namespace ocurrs and replaced it with the new one but to no avail...
Anyone have any ideas?
Haha I just remembered how I did it last time - you have to manually delete the old dll's from the bin folder. Doing a clean doesn't get rid of them because a clean only delete's DLL's that match the project name - hence it leaves the DLL's with the old project name.
Adding a few more for anyone else. These cost me an hour of my life that I'm not getting back.
Delete not only \bin files, but also \obj\debug and \release too.
Delete temporary ASP.NET files.
Check for any references to old DLL name in web.config.
Check all web.config files. Sometimes one is added to the Views folder too.
Alternatively, you can follow these simple steps.
- Go to your Project Solution Explorer
- Right-click on Global.asax file
- Select "Open-with" option
- Select "Global.asax File Editor with Encoding"
- Click Ok and you can change the code to rectify the error yourself.
Try it! It worked for me.
精彩评论