2009-11-09 41 views
1

我期待在这里Haacks文章 - http://haacked.com/archive/2009/07/31/single-project-areas.aspxAsp.Net MVC - 地区

当我下载的样本,我得到的Global.ascx以下错误

错误1“的System.Web .Routing.RouteCollection” 不包含 定义‘MapAreaRoute’,没有扩展方法 ‘MapAreaRoute’接受型的第一 参数 ‘System.Web.Routing.RouteCollection’ 可以找到(是否缺少 使用指令或装配 参考?)

我假设我明显缺少somthing,任何人有什么想法是什么?

回答

2

您现在应该使用“AreaRegistration.RegisterAllAreas”在新的实施

本博客文章可能是你有帮助:

代码

http://suhair.in/Blog/aspnet-areas-in-depth

片段从博客:

protected void Application_Start() 
{ 
    AreaRegistration.RegisterAllAreas(); 1 
    RegisterRoutes(RouteTable.Routes); 
} 

plus ...

public static void RegisterAllAreas() 
{ 
     RegisterAllAreas(null); 
} 

public static void RegisterAllAreas(object state) 
{ 
           2      3 
     RegisterAllAreas(RouteTable.Routes, new BuildManagerWrapper(), state); 
}