I just came across following error message while I was refactoring one of my ASP.NET MVC applications:
Multiple types were found that match the controller named 'Home'.
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 'Home' has found the following matching controllers:
hbulens.WebUI.POC.Controllers.HomeController
hbulens.POC.WebUI.HomeController
**Beschrijving: **Er is een onverwerkte uitzondering opgetreden tijdens het uitvoeren van de huidige webaanvraag. Raadpleeg de stacktracering voor meer informatie over deze fout en de oorsprong ervan in de code.
**Details van uitzondering: **System.InvalidOperationException: Multiple types were found that match the controller named 'Home'. 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 'Home' has found the following matching controllers:
hbulens.WebUI.POC.Controllers.HomeController
hbulens.POC.WebUI.HomeController
Normally, you would expect something is wrong with the routing engine, The error messages on this subject are quite clear:
[InvalidOperationException: Multiple types were found that match the controller named 'Home'. 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.
In my case, this wasn’t the problem. Instead, I changed the namespaces and assembly name of my MVC project from hbulens.WebUI.POC to hbulens.POC.WebUI, but the ASP.NET MVC project itself remained intact. Being uncautious, I left the old assembly output in the bin folder while I was trying to debug the new assembly output, with beforementioned error as a result. There is a very easy way to fix this: delete your bin folder and rebuild your project.