1
我在mvc4应用程序中有2个区域,并且我已注册每个区域的名称空间。MVC4路由包含具有相同名称的控制器的2个区域
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Intergration_default",
"Intergration/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional },
constraints: null,
namespaces: new[] { "WebApplication.Areas.Intergration.Controllers" }
);
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Vend_default",
"Vend/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional},
constraints: null,
namespaces: new[] { "WebApplication.Areas.MyController.Controllers" }
);
我可以然而进入一体化/时myController的我尝试访问我myController的得到一个错误
多种类型的发现匹配名为“myController的”的控制器。如果为该请求提供服务的路由('{controller}/{action}/{id}')没有指定命名空间来搜索与该请求匹配的控制器,就会发生这种情况。如果是这种情况,请通过调用带有'namespaces'参数的'MapRoute'方法的重载来注册此路由。
我在做什么错?我需要做些额外的事情在根据您提供的代码/说明在Global.asax