Visual studio 2010 我能';在VS2010中无法使区域工作

Visual studio 2010 我能';在VS2010中无法使区域工作,visual-studio-2010,asp.net-mvc-2,Visual Studio 2010,Asp.net Mvc 2,我刚从VS2010 RC升级到RTM。现在我的区域不工作了。我有一个配置文件区域,其中有一个主控制器和一个操作方法索引() 如果我尝试:我会得到一个404错误,表示找不到资源。如果我尝试,我会得到同样的错误。但是,如果我尝试,则会返回视图 这是我的注册资料: 公共类档案AreaRegistration:AreaRegistration { 公共重写字符串区域名 { 得到 { 返回“Profile”; } } public override void RegisterArea(AreaRe

我刚从VS2010 RC升级到RTM。现在我的区域不工作了。我有一个配置文件区域,其中有一个主控制器和一个操作方法索引()

如果我尝试:我会得到一个404错误,表示找不到资源。如果我尝试,我会得到同样的错误。但是,如果我尝试,则会返回视图

这是我的注册资料:

公共类档案AreaRegistration:AreaRegistration { 公共重写字符串区域名 { 得到 { 返回“Profile”; } }

    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 }
        );
    }

有人知道出了什么问题吗?

使用路由调试器找出正在应用的路由


这就成功了!不过还有一个问题。我在另一个区域中有一个自定义路由约束,看起来是这样的:context.maprote(“Account_Users”,“Account/Users/{action}/{pageNumber}/{pageSize}/{filter}/{orderBy}”,new area=“Account”,controller=“Users”,action=“List”,pageNumber=1,pageSize=20,filter=“all”,orderBy=“name”},新[]{“NS.Web.Areas.Account”});route tester显示这是第一个要匹配的路由,但我仍然收到404错误。是否知道是什么导致了这一错误?List方法从未被命中。但是,我找到了答案。我删除了路由定义中的命名空间声明,它就行了。我不确定为什么这会产生不同,但现在它工作正常。