在将我的ASP MVC 3应用程序从Beta版更新为Realease候选版后,我遇到此错误:
{"Method not found: 'Void System.Web.Mvc.GlobalFilterCollection.Add(System.Object, System.Nullable`1<Int32>)'."}
该代码内的
Global.asax
中发生错误: protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters); // <-- Here
RegisterRoutes(RouteTable.Routes);
}
这是我的
RegisterGlobalFilters()
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
这是我的System.Web.MVC.dll的详细信息:
实际上,程序集文件夹中缺少System.Web.MVC.dll文件,应该在这里吗?
这是我的计算机上安装的所有MVC应用程序的屏幕截图,在重新安装RC之前,beta版本是完整的,我也是通过Microsoft Web Platform Installer安装的,因此我认为应该没问题:
有人知道了吗?
最佳答案
在Reflector中查看System.Web.Mvc.dll的RC版本,我看到一个private void AddInternal(object filter, int? order)
方法。听起来像是在Beta中曾经被命名为Add
。
RC版本为3.0.11029.0
。检查您在C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies
中具有的dll版本,如果在已发布/已部署的网站上看到该错误,也请检查该dll版本。
编辑
在release notes上找到了安装说明:
您必须在安装ASP.NET MVC 3 RC之前卸载ASP.NET MVC 3 Preview 1或ASP.NET MVC 3 Beta。
我不确定卸载Beta会清除哪些内容,但是如果您没有卸载Beta,则可能要卸载RC和Beta,然后重新安装RC。