title: ASP.NET vNext, multiple HomeControllers in areas
body: <p>I'm having a look at ASP.NET 5 and MVC 6 and I'm using the default starter template. I have now set up an area in which I would like to have an "HomeController". So there will be the default HomeController which isn't placed in an area and then there will be the HomeController in Areas/MyArea. </p>
  
  <p>The following configuration in Startup.cs does obviously not work:</p>
  
  <pre><code>            routes.MapRoute(
                  name: "areaRoute",
                  template: "{area:exists}/{controller}/{action}",
                  defaults: new { controller = "Home", action = "Index" });
  
              routes.MapRoute(
                  name: "default",
                  template: "{controller}/{action}/{id?}",
                  defaults: new { controller = "Home", action = "Index" });
  </code></pre>
  
  <p>It gives me this error message:</p>
  
  <blockquote>
    <p>AmbiguousActionException: Multiple actions matched. The following
    actions matched route data and had all constraints satisfied:</p>
    
    <p>MyProject.Controllers.HomeController.Index
    MyProject.Areas.MyArea.Controllers.HomeController.Index</p>
  </blockquote>
  
  <p>In earlier MVC versions you should be able to solve it by defining namespaces to the routes config like discussed in this blog post: <a href="http://blog.falafel.com/duplicate-controller-names-aspnet-mvc-areas/" rel="nofollow">http://blog.falafel.com/duplicate-controller-names-aspnet-mvc-areas/</a></p>
  
  <p>Though this is not working for me. If I add <code>namespaces: new string[] { "MyProject.Controllers" }</code> to the default route I'm getting the following error:</p>
  
  <blockquote>
    <p>Error CS1501  No overload for method 'MapRoute' takes 4
    arguments MyProject.ASP.NET 5.0   Startup.cs  81</p>
  </blockquote>
  
  <p>I will be very grateful if I can get some advice about this, it would be nice to be able to use more than one HomeController in my system. </p>