Using Visual Studio 2013, I migrated the Asp.Net Webforms / MVC 3 / Framework 4.0 hybrid web application to Asp.Net Webforms / MVC 5.2.2 / Framework 4.5.1.
I followed the steps described in these links:
http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and- web-api-2
http://www.asp.net/signalr/overview/signalr-20/getting-started-with-signalr-20/upgrading-signalr-1x-projects-to-20
When I run the application in visual studio, I get this error:
The transparent security method 'System.Web.WebPages.Administration.SiteAdmin.RegisterAdminModule ()' attempted to access the critical critical security method 'System.Web.WebPages.ApplicationPart..ctor (System.Reflection.Assembly, System.String)' not managed.
I tried these suggestions that I found on StackOverflow, but no one fixes the problem:
- empty bin folder and rebuild
- Install the Nuget Microsoft.Aspnet.WebHelpers package.
- Make sure that all web.config links from System.Web.Mvc and System.Web.WebPages point to the correct version (5.2.2.0 and 3.0.0.0 respectively).
Any advice on how to find the cause of this error would be greatly appreciated.
Full error stack error:
[MethodAccessException: Attempt by security transparent method 'System.Web.WebPages.Administration.SiteAdmin.RegisterAdminModule()' to access security critical method 'System.Web.WebPages.ApplicationPart..ctor(System.Reflection.Assembly, System.String)' failed.] System.Web.WebPages.Administration.SiteAdmin.RegisterAdminModule() +96 System.Web.WebPages.Administration.PreApplicationStartCode.Start() +41 [InvalidOperationException: The pre-application start initialization method Start on type System.Web.WebPages.Administration.PreApplicationStartCode threw an exception with the following error message: Attempt by security transparent method 'System.Web.WebPages.Administration.SiteAdmin.RegisterAdminModule()' to access security critical method 'System.Web.WebPages.ApplicationPart..ctor(System.Reflection.Assembly, System.String)' failed..] System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +559 System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +132 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +102 System.Web.Compilation.BuildManager.ExecutePreAppStart() +153 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516 [HttpException (0x80004005): The pre-application start initialization method Start on type System.Web.WebPages.Administration.PreApplicationStartCode threw an exception with the following error message: Attempt by security transparent method 'System.Web.WebPages.Administration.SiteAdmin.RegisterAdminModule()' to access security critical method 'System.Web.WebPages.ApplicationPart..ctor(System.Reflection.Assembly, System.String)' failed..] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9913572 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
source share