Reputation: 1458
Title says it all; we've recently updated our web project to use MVC 5 but this doesn't seem to be playing nice with the other references we're using in our project. When running we get the following message:
Attempt by security transparent method 'WebMatrix.WebData.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.WebPageRazorHost.AddGlobalImport(System.String)' failed.
The exception details said that:
System.MethodAccessException: Attempt by security transparent method 'WebMatrix.WebData.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.WebPageRazorHost.AddGlobalImport(System.String)' failed.
To try and resolve this we have done the following:
Microsoft.AspNet.WebHelpers
Microsoft.AspNet.WebPages.Data
We're using WebMatrix v2 and this is referenced in our Web.config like this:
<dependentAssembly>
<assemblyIdentity name="WebMatrix.WebData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebMatrix.Data" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
The project is targeting .net v4.5.2. Our MVC is referenced correctly in our config, and all other googled solutions haven't done it for us. Does anyone have any ideas on what might be going wrong?
Upvotes: 0
Views: 411