__Setup__:
I have an application where I use both conventional & attributed controllers. I use attributed controller in an area called "Administration".
__Routes__:
```
routes.MapMvcAttributeRoutes();
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
```
__Controllers__:
```
using System.Web.Mvc;
namespace RuntimeWebApp
{
namespace Areas.Administration.Controllers
{
[RouteArea("Administration", AreaPrefix = "Admin")]
[Route("Home/{action}")]
public class HomeController : Controller
{
public ActionResult Index()
{
return Content("Admin.Home.Index");
}
}
}
namespace Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
return Content("Home.Index");
}
}
}
}
```
__Requests__:
GET /Admin/Home/Index -> Succeeds and prints "Admin.Home.Index"
GET /Home/Index -> __Fails__ with 500 Internal Server Error
__Exception__:
```
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:
RuntimeWebApp.Areas.Administration.Controllers.HomeController
RuntimeWebApp.Controllers.HomeController
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: 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:
RuntimeWebApp.Areas.Administration.Controllers.HomeController
RuntimeWebApp.Controllers.HomeController
```
__Expected__:
When a request matches a conventional route, the probing of controllers should only consider NON-attributed controllers. Here as you can see the probing is even considering the attributed controller too.
I have an application where I use both conventional & attributed controllers. I use attributed controller in an area called "Administration".
__Routes__:
```
routes.MapMvcAttributeRoutes();
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
```
__Controllers__:
```
using System.Web.Mvc;
namespace RuntimeWebApp
{
namespace Areas.Administration.Controllers
{
[RouteArea("Administration", AreaPrefix = "Admin")]
[Route("Home/{action}")]
public class HomeController : Controller
{
public ActionResult Index()
{
return Content("Admin.Home.Index");
}
}
}
namespace Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
return Content("Home.Index");
}
}
}
}
```
__Requests__:
GET /Admin/Home/Index -> Succeeds and prints "Admin.Home.Index"
GET /Home/Index -> __Fails__ with 500 Internal Server Error
__Exception__:
```
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:
RuntimeWebApp.Areas.Administration.Controllers.HomeController
RuntimeWebApp.Controllers.HomeController
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: 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:
RuntimeWebApp.Areas.Administration.Controllers.HomeController
RuntimeWebApp.Controllers.HomeController
```
__Expected__:
When a request matches a conventional route, the probing of controllers should only consider NON-attributed controllers. Here as you can see the probing is even considering the attributed controller too.