Note that there are some explanatory texts on larger screens.

plurals
  1. POHaving issue with multiple controllers of the same name in my project
    text
    copied!<p>I am running into the following error with my ASP.NET MVC 3 project:</p> <blockquote> <p>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.</p> <p>The request for 'Home' has found the following matching controllers: MyCompany.MyProject.WebMvc.Controllers.HomeController MyCompany.MyProject.WebMvc.Areas.Company.Controllers.HomeController</p> </blockquote> <p>I have a HomeController in my default controller folder, with a class name of MyCompany.MyProject.WebMvc.Controllers.HomeController. </p> <p>My RegisterRoutes method, in my global.asax, looks like:</p> <pre><code> public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); } </code></pre> <p>I then have an area called Company, with a HomeController in the default controller folder for the area, with a class name of MyCompany.MyProject.WebMvc.Areas.Company.Controllers.HomeController.</p> <p>The RegisterArea method in the CompanyAreaRegistration file looks like:</p> <pre><code> public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute( "Company_default", "Company/{controller}/{action}/{id}", new { area = "Company", action = "Index", id = UrlParameter.Optional } ); } </code></pre> <p>This is all leading the error I highlighted at the beginning of this post. I am struggling trying to piece together a solution from various other posts, with <strong>NO LUCK</strong>. </p> <p>Is it possible to have a HomeController in the default controllers folder and then one in EACH area? If so, do I need to make (assuming I do) changes to my configuration file to make this work? </p> <p>Any help would be much appreciated!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload