【发布时间】:2010-05-02 01:57:34
【问题描述】:
我刚刚从 VS2010 RC 升级到 RTM。现在我的区域不工作了。我有一个带有 Home 控制器和 Action 方法 Index() 的 Profile 区域。
如果我尝试:http://localhost:4951/profile 我收到 404 错误,提示找不到资源。如果我尝试http://localhost:4951/profile/home 我会得到同样的错误。但是,如果我尝试http://localhost:4951/profile/home/index,则会返回视图。
这是我的 ProfileAreaRegistration:
公共类 ProfileAreaRegistration :AreaRegistration { 公共覆盖字符串 AreaName { 得到 { 返回“个人资料”; } }
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Profile_Unlock",
"Profile/Unlock/{userID}/{unlockID}",
new { controller = "Unlock", action = "Index" },
new { userID = new GuidRouteConstraint(), unlockID = new GuidRouteConstraint() }
);
context.MapRoute(
"Profile_default",
"Profile/{controller}/{action}/{id}",
new { action = "Home", id = UrlParameter.Optional }
);
}
有人知道怎么回事吗?
【问题讨论】:
标签: visual-studio-2010 asp.net-mvc-2