[Fix] - Attempt by security transparent method WebMatrix WebData PreApplicationStartCode Start
Migrating a project created with MVC current version to the next version. The migrated project throws error at runtime.
Attempt by security transparent method 'WebMatrix.WebData.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.WebPageRazorHost.AddGlobalImport(System.String)' failed
- The solution is to install Nuget Package Microsoft.AspNet.WebHelpers as follows:
Install-Package -Id Microsoft.AspNet.WebHelpers
- Upon installing Microsoft.AspNet.WebHelpers via NuGet the next error that follows is
- "Could not load file or assembly 'WebMatrix.Data, Version=220.127.116.11, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)."
- To fix the above error, install the below Nuget Package:
- Now close and reopen the upgraded MVC projects to execute without errors.
Fixes are applicable to the following versions of Visual Studio:
Related Error Tags :
- c# - Is ASP.NET MVC 5 incompatible with the WebMatrix
- How to fix System.MethodAccessException in ASP.NET MVC
- Upgrading from MVC 4 to MVC 5
- Upgrading a Web Application Using SimpleMembership to ASP.NET
- Attempt by security transparent method 'WebMatrix.WebData preapplicationstartcod
- How to Fix SimpleSecurity Error when Upgrading from in C#
- attempt by security transparent method 'WebMatrix.WebData
- attempt by security transparent method 'system.web.mvc.preapplicationstartcode.start()' to access