I have two web projects in the same solution, the first starts and the second gives me an error:
"Multiple types were found that match the controller named 'Home'. This can happen if the route that services this request ('Home / {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. "
I specify that :
- The two projects have a different namespace (Intranet / Extranet).
- The two projects are completely independent.
- The two projects do not reference each other.
- I DO NOT want to add a zone.
- The two projects are (in development) hosted on my local IIS, each with a different domain name (intranet.lan / extranet.lan).
I don't understand how to tell Visual Studio not to look in other projects. This behavior is really abnormal, I think it is a bug or a very bad design strategy.
I also presume that I have read a lot of post dealing with the subject without ever finding any answer. Everyone creates an area (I don't want to, because it's not "clean" creating an area in a project just for the project is something totally stupid and illogical).
If anyone can help me it would be very nice.
Edit:
I place my Extranet project in a separate directory, I create a new solution and I add it. I configure it to launch under IIS Express and it also tells me that it finds two controllers. That of Intranet and Extranet. However Ctrl + F with "Intranet" in the extranet project gives no results. I also opened the project and solution file and I cannot find any reference to Intranet. It's incredible, the Intranet project seems to be linked to extranet but without any reference or ponitage whatsoever in the code. Even after rebuild the project.
Edit2:
I tried with
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
namespaces: new[] { "Extranet.Controllers" }
);
Or
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
namespaces: new[] { "Extranet.Controllers" }
);
But no effect.