我有两个领域:
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'
。
我不确定我做错了什么。