My scenario:
I was forced to rename an ASP.NET MVC application due to some problems with MSBuild (different story). For the sake of cleanliness I also renamed namespaces within my application.
Every time I ran the app I had the following exception:
Multiple types were found that match the controller named 'Home'. This can happen if the route that services this request ('{controller}/{action}') 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 WebRuntime solution which is the source code for the RTM version of ASP.NET MVC offered some clues as to why since it performs Assembly loading. The bin directory that resides under my WebApplication project still contained the old dll (prior to renaming). This confused MVC as it encountered multiple controllers named the same. Simply delete the old dll and the issue should dissapear.
Also make sure that any strongly-typed Views and Global.asax mark-up are updated with the correct namespaces.
Thanks... worked.
ReplyDelete