开发者

Error after updating from ASP MVC 3 Beta to RC

开发者 https://www.devze.com 2023-01-28 09:25 出处:网络
After I updated my ASP MVC 3 application from the beta version to the realease candidate I encounter this error:

After I updated my ASP MVC 3 application from the beta version to the realease candidate I encounter this error:

{"Method not found: 'Void System.Web.Mvc.GlobalFilterCollection.Add(System.Object, System.Nullable`1<Int32>)'."}

The error occurs in Global.asax inside this code:

    protected void Application_Start()
    {
        AreaRegistration.RegisterAllAreas();

        RegisterGlobalFilters(GlobalFilters.Filters); // <-- Here
        RegisterRoutes(RouteTable.Routes);
    }

Here is my RegisterGlobalFilters()

    public static void RegisterGlobalFilters(GlobalFilterCollection filters)
    {
        filters.Add(new HandleErrorAttribute());
    }
开发者_开发技巧

Here is the details of my System.Web.MVC.dll:

Error after updating from ASP MVC 3 Beta to RC

The System.Web.MVC.dll file is actually missing from the assembly folder, should it be here?

Error after updating from ASP MVC 3 Beta to RC

Here is a screenshot of all MVC applications installed on my computer, the beta was unsintalled before I did a new install of RC, I also installed through Microsoft Web Platform Installer so I think it should be ok:

Error after updating from ASP MVC 3 Beta to RC

Anyone got a clue?


Looking at the RC version of System.Web.Mvc.dll in Reflector, I see a private void AddInternal(object filter, int? order) method. It sounds like this used to be named Add in the beta.

The RC version is 3.0.11029.0. Check the version of the dll you have in C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies, and if you are seeing the error on a published/deployed web site, check the dll version there as well.

Edit

Found an installation note on the release notes:

you must uninstall ASP.NET MVC 3 Preview 1 or ASP.NET MVC 3 Beta before installing ASP.NET MVC 3 RC.

I'm not sure what gets cleaned up by uninstalling the beta, but if you did not unininstall the beta, you might want to uninstall the RC and the beta, then reinstall the RC.


Here's how the RegisterGlobalFilters method looks like in the default template of an ASP.NET MVC 3 RC application:

public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
    filters.Add(new HandleErrorAttribute());
}

Does yours look the same? Obviously the second parameter (a Nullable<int>) has been removed from the Add method.


Make sure that you have the right version of System.Web.Mvc.dll on your test machine. Ff MVC 3 Beta is installed into the GAC then it will always win, even if you have the RC version in your app's bin folder. Try to find out from which directory your dll is being loaded.

0

精彩评论

暂无评论...
验证码 换一张
取 消