我面临一个奇怪的问题,以下行适用于多个环境,但在我们的一台服务器上,它抛出 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" }
);
}