名为“Home_default2”的路由已在路由集合中。路由名称必须是唯一的。
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
AreaRegistration.RegisterAllAreas();
routes.MapRoute(
name: "Default",
url: "area/{controller}/{action}/{id}",
defaults: new {area="Home_Default", controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
public override string AreaName
{
get
{
return "Home";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Home_default2",
"Home/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional }
);
}
}
自动生成的代码有问题,我做错了什么?