我刚从VS2010 RC升级到RTM。现在我的区域不起作用了。我有一个配置文件区域,其中包含一个Home控制器和一个Action方法Index()。
如果我尝试:http://localhost:4951/profile我收到404错误,说无法找到资源。如果我尝试http://localhost:4951/profile/home,我会得到同样的错误。但是,如果我尝试http://localhost:4951/profile/home/index,则返回视图。
这是我的ProfileAreaRegistration:
public class 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 }
);
}
有谁知道出了什么问题?
答案 0 :(得分:1)
使用路由调试器找出正在应用的路由
http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx