【发布时间】:2010-04-26 06:31:39
【问题描述】:
我有两个领域:
ControlPanel 和 Patients。
两者都有一个名为 ProblemsController 的控制器,只是名称相似。期望的结果是产生 /controlpanel/problems => MyApp.Areas.ControlPanel.Controllers.ProblemsController 和 /patients/problems => MyApp.Areas.Patients.Controllers.ProblemsController 的路由。
每个都有这样配置的路由:
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"**Area Name Here**_default",
"**Area Name Here**/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional }
);
}
这里 ***** 区域名称 ***** 是 ControlPanel 或患者。
当我转到 /patients/problems/create(例如)时,我得到一个 404,其中路由错误显示:A public action method 'create' was not found on controller 'MyApp.Areas.ControlPanel.Controllers.ProblemsController'。
我不确定自己做错了什么。
【问题讨论】:
标签: asp.net-mvc-2 asp.net-mvc-routing autofac asp.net-mvc-areas