Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple types were found that match the controller named 'Home'. (weird error)

I am having this error on my new asp.net app

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: Contoso.CAMPF.Sample1Web.Controllers.HomeController CAMPF.WebApp.Controllers.HomeController

The weird thing is that I dont event have a constoso namespace anywhere, I removed it, in the past I did, but I decided at some point to change assembly and namespaces names.

namespace CAMPF.WebApp.Controllers
{
    public class HomeController : Controller
    {
        [SharePointContextFilter]
        public ActionResult Index()
        {
like image 576
Luis Valencia Avatar asked May 10 '14 23:05

Luis Valencia


2 Answers

found the error, because I changed the namespace and assembly name, then on the bin folder the old dll was still there, so it looks like the mvc engine searches for controllers in the entire bin folder

like image 159
Luis Valencia Avatar answered Nov 08 '22 18:11

Luis Valencia


I had the same issue. It turns out, the old .ddl files were still in the bin folder. After removing those, everything was fine. Basically when you had renamed the namespace, it effectively renamed the output assembly. Upon build, the new .ddls were created, but the old .ddls still existed.

Good luck, happy coding :))))

like image 22
john madsen Avatar answered Nov 08 '22 19:11

john madsen