我遇到一个奇怪的问题,其中以下行适用于多个环境,但在我们的某个服务器上,它会抛出System.InvalidOperationException:路由表中没有路由与提供的值匹配。
@{Html.RenderAction("Action", "Home", new { area = "Custom" });}
任何想法要找什么?
RouteConfig.cs的内容:
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new[] { "Backoffice.Controllers" }
);
CustomAreaRegistration.cs的内容:
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Custom_default",
"Custom/{controller}/{action}",
new { action = "Index" }
);
}