Everyting seems to go fine, i get no errors during installation. But when i run my application i get the following error:
Server Error in '/' Application.
Attempt by security transparent method 'System.Web.Mvc.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.PreApplicationStartCode.Start()' failed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.MethodAccessException: Attempt by security transparent method 'System.Web.Mvc.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.PreApplicationStartCode.Start()' failed.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[MethodAccessException: Attempt by security transparent method 'System.Web.Mvc.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.PreApplicationStartCode.Start()' failed.]
System.Web.Mvc.PreApplicationStartCode.Start() +46
Microsoft.Web.Mvc.ViewEngineFix.PreAppStart() +49
[InvalidOperationException: The pre-application start initialization method PreAppStart on type Microsoft.Web.Mvc.ViewEngineFix threw an exception with the following error message: Attempt by security transparent method 'System.Web.Mvc.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.PreApplicationStartCode.Start()' failed..]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +12969195
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +12968904
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +280
System.Web.Compilation.BuildManager.ExecutePreAppStart() +172
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1151
[HttpException (0x80004005): The pre-application start initialization method PreAppStart on type Microsoft.Web.Mvc.ViewEngineFix threw an exception with the following error message: Attempt by security transparent method 'System.Web.Mvc.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.PreApplicationStartCode.Start()' failed..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12968244
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12807949
I have tried a couple of fixes, like running 'Install-Package-IdMicrosoft.AspNet.WebHelpers' from the console. But nothing seems to fix this.
How did you setup your installation? And is all the neccesary dependencies in place?
I usually use webmatrix for doing initial installs on new machines since it makes sure to download all frameworks etc. that Umbraco needs in order to work.
So perhaps you can download webmatrix and do an installation from here so all necessary dependencies gets installed?
Well in the guide i used it mentioned using Nuget which should simplify the installation. So i started an ASP.NET web application project targeting framework 4.5 and installed Umbraco using Nuget. When i run the application i get the mentioned error.
When i check the installation documentation for Nuget installation i see a difference in framework version. The guide i mentioned uses 4.5 and the installation document says 4.0. I have actually tried both versions but they neither one works.
I have tested installation through Webmatrix just now, but according to the installation i now have installed Umbraco 6.1.6. and not 7.0.4. Can i do an easy upgrade from 6 to 7?
Ok, unfortunately it seems that there has been some issues installing Umbraco 7.0.x using nuget, but try having a look at the issue tracker http://issues.umbraco.org/issues?q=nuget - In some of those fixed issues reported for 7.0.x you might find the answer to the issue.
As far as I know all of this should be fixed with the 7.1 release scheduled for thursday though.
This error is not something we've encountered before and it looks like it's caused by you setting up a project with MVC 5 (at least that's what I've gathered from the Google results). We do not yet support MVC5, so make sure to use an Empty project type (as covered in the docs) or and MVC4 project type (but I'm not entirely sure that will work out of the box, haven't tested 7.0.4 in a while).
I would really like the Nuget thing to work, because that seems like the easiest way to install an Umbraco project. So i will try Sebastiaan's suggestion and see if that works, i might have selected MVC 5 by accident.
So i selected .Net Framework 4 and MVC 4, created an empty site, installed umbraco through Nuget. I now get the following error: Could not load types from assembly umbraco, Version=1.0.5161.21058, Culture=neutral, PublicKeyToken=null, errors: Exception: System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method. Type: 'Umbraco.Web.Editors.ContentPostValidateAttribute'. Assembly: 'umbraco, Version=1.0.5161.21058, Culture=neutral, PublicKeyToken=null'. Exception: System.TypeLoadException: Could not load type 'System.Web.Http.Controllers.IControllerConfiguration' from assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Exception: System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method. Type: 'Umbraco.Web.WebApi.Filters.EnsureUserPermissionForContentAttribute'. Assembly: 'umbraco, Version=1.0.5161.21058, Culture=neutral, PublicKeyToken=null'. Exception: System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method. Type: 'Umbraco.Web.WebApi.Filters.EnsureUserPermissionForMediaAttribute'. Assembly: 'umbraco, Version=1.0.5161.21058, Culture=neutral, PublicKeyToken=null'. Exception: System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method. Type: 'Umbraco.Web.WebApi.Filters.FileUploadCleanupFilterAttribute'. Assembly: 'umbraco, Version=1.0.5161.21058, Culture=neutral, PublicKeyToken=null'. Exception: System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method. Type: 'Umbraco.Web.WebApi.Filters.FilterAllowedOutgoingMediaAttribute'. Assembly: 'umbraco, Version=1.0.5161.21058, Culture=neutral, PublicKeyToken=null'. Exception: System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method. Type: 'Umbraco.Web.WebApi.Filters.FilterAllowedOutgoingMediaAttribute'. Assembly: 'umbraco, Version=1.0.5161.21058, Culture=neutral, PublicKeyToken=null'.
I have seen this one before on these forums, but those suggestions do not work for me. Using Update-Package Microsoft.AspNet.WebApi -Version 4.0.30506 tells me there are no updates. Same goes for Update-Package Microsoft.Net.Http -Version 2.0.20710.0
Quick fix for this one is that, first install Umbraco normally using Nuget package manager. Once installation is done, open the Nuget Package Manager Console and run "Install-Package Microsoft.AspNet.Mvc" command. This will fix all your issues. :)
I received this error when performing a manual upgrade from v7.2.4 to v7.3.1.
I ended up comparing the bin folder from the downloaded v7.3.1 against the upgraded site with the error and found that the download had fewer files. I resolved the issue by deleting the following files from the bin folder (just the dlls will have fixed it, but the pdb's aren't in the 7.3.1 release):
I hit this one by overwriting an old site with a new one from my local box, and as you say must have resulted in some "orphan" assembly(ies) in the /bin which were still being loaded into the app domain and causing this error. I just deleted the bin and copied my fresh local copy up to the server and happy days. Cheers.
Thanks to James Wilkinson (see post above) I could fix this by removing Microsoft.Web.Helpers.dll and Microsoft.Web.Mvc.FixedDisplayModes.dll from the bin folder. The other files mentioned by James where not in my bin.
Thanks James!!
BTW: No VS and so no Nu-Get involved, I always do manual installs.
Fresh install of Umbraco 7.0.4 does not work
Im trying to install Umbraco 7.0.4 on a Windows 7 Pro 64 bit machine using Visual Studie 2013 Pro following this guide:
http://www.systenics.com/blog/setting-up-umbraco-7-in-visual-studio-2013-for-mvc-4-development/
Everyting seems to go fine, i get no errors during installation. But when i run my application i get the following error:
Server Error in '/' Application.
Attempt by security transparent method 'System.Web.Mvc.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.PreApplicationStartCode.Start()' failed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.MethodAccessException: Attempt by security transparent method 'System.Web.Mvc.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.PreApplicationStartCode.Start()' failed.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
I have tried a couple of fixes, like running 'Install-Package -Id Microsoft.AspNet.WebHelpers' from the console. But nothing seems to fix this.
Can anyone help me?
Hi Bunnynut
How did you setup your installation? And is all the neccesary dependencies in place?
I usually use webmatrix for doing initial installs on new machines since it makes sure to download all frameworks etc. that Umbraco needs in order to work.
So perhaps you can download webmatrix and do an installation from here so all necessary dependencies gets installed?
It's always a good idea to check the installation documentation when something goes unexpectedly wrong.
Hope this helps.
/Jan
Hi Jan,
Well in the guide i used it mentioned using Nuget which should simplify the installation.
So i started an ASP.NET web application project targeting framework 4.5 and installed Umbraco using Nuget.
When i run the application i get the mentioned error.
When i check the installation documentation for Nuget installation i see a difference in framework version.
The guide i mentioned uses 4.5 and the installation document says 4.0.
I have actually tried both versions but they neither one works.
I have tested installation through Webmatrix just now, but according to the installation i now have installed Umbraco 6.1.6. and not 7.0.4.
Can i do an easy upgrade from 6 to 7?
Hi Bunnynut
Ok, unfortunately it seems that there has been some issues installing Umbraco 7.0.x using nuget, but try having a look at the issue tracker http://issues.umbraco.org/issues?q=nuget - In some of those fixed issues reported for 7.0.x you might find the answer to the issue.
As far as I know all of this should be fixed with the 7.1 release scheduled for thursday though.
Hope this helps.
/Jan
Thats good to know, i can wait till thursday.
Thanks for your help!
Hi Bunnynut
You could perhaps also try out the 7.1RC and see if it works?
It's placed to the right of the beta download.
/Jan
This error is not something we've encountered before and it looks like it's caused by you setting up a project with MVC 5 (at least that's what I've gathered from the Google results). We do not yet support MVC5, so make sure to use an Empty project type (as covered in the docs) or and MVC4 project type (but I'm not entirely sure that will work out of the box, haven't tested 7.0.4 in a while).
I would really like the Nuget thing to work, because that seems like the easiest way to install an Umbraco project.
So i will try Sebastiaan's suggestion and see if that works, i might have selected MVC 5 by accident.
So i selected .Net Framework 4 and MVC 4, created an empty site, installed umbraco through Nuget. I now get the following error:
Could not load types from assembly umbraco, Version=1.0.5161.21058, Culture=neutral, PublicKeyToken=null, errors:
Exception: System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method. Type: 'Umbraco.Web.Editors.ContentPostValidateAttribute'. Assembly: 'umbraco, Version=1.0.5161.21058, Culture=neutral, PublicKeyToken=null'.
Exception: System.TypeLoadException: Could not load type 'System.Web.Http.Controllers.IControllerConfiguration' from assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Exception: System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method. Type: 'Umbraco.Web.WebApi.Filters.EnsureUserPermissionForContentAttribute'. Assembly: 'umbraco, Version=1.0.5161.21058, Culture=neutral, PublicKeyToken=null'.
Exception: System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method. Type: 'Umbraco.Web.WebApi.Filters.EnsureUserPermissionForMediaAttribute'. Assembly: 'umbraco, Version=1.0.5161.21058, Culture=neutral, PublicKeyToken=null'.
Exception: System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method. Type: 'Umbraco.Web.WebApi.Filters.FileUploadCleanupFilterAttribute'. Assembly: 'umbraco, Version=1.0.5161.21058, Culture=neutral, PublicKeyToken=null'.
Exception: System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method. Type: 'Umbraco.Web.WebApi.Filters.FilterAllowedOutgoingMediaAttribute'. Assembly: 'umbraco, Version=1.0.5161.21058, Culture=neutral, PublicKeyToken=null'.
Exception: System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method. Type: 'Umbraco.Web.WebApi.Filters.FilterAllowedOutgoingMediaAttribute'. Assembly: 'umbraco, Version=1.0.5161.21058, Culture=neutral, PublicKeyToken=null'.
I have seen this one before on these forums, but those suggestions do not work for me.
Using Update-Package Microsoft.AspNet.WebApi -Version 4.0.30506 tells me there are no updates.
Same goes for Update-Package Microsoft.Net.Http -Version 2.0.20710.0
Hi Bunnynut,
I think I've cracked it now, see the comment here if you want to try again with an improved version of the NuGet package: http://issues.umbraco.org/issue/U4-4510#comment=67-13390
Summary:
Do NOT select MVC, but Empty. Also DO select .NET 4.5 or .NET 4.5.1, Umbraco 7 does not support .NET 4.0.
Hij Sebastiaan,
Sorry replying this late and thanks for this fix.
I will try your suggestion and get with you with my findings.
Oh, make sure to use the latest version though (7.1.1 was just released)
Documentation here: http://our.umbraco.org/documentation/Installation/install-umbraco-with-nuget
Hi Sebastiaan,
I got it to work using the suggestions you mentioned.
thanks a lot for your time!
Hi guys,
old thread I know but I'm now having this same issue.
Installed Umbraco via Nuget, followed instructions from: http://our.umbraco.org/documentation/Installation/install-umbraco-with-nuget
Current Umbraco version installed by Nuget is 7.2.1
It was working ok at first until I ran update-package to get the latest allowed versions of everything. Now getting the following:
Attempt by security transparent method 'Microsoft.Web.Helpers.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.WebPageRazorHost.AddGlobalImport(System.String)' failed.
I'm going to try and roll back to a point in time pre updating all packages but it's clear there is still an issue somewhere, any ideas welcome.
Thanks,
Lee
@Lee before you roll back, does this help? http://stackoverflow.com/a/19568376/5018
Quick fix for this one is that, first install Umbraco normally using Nuget package manager. Once installation is done, open the Nuget Package Manager Console and run "Install-Package Microsoft.AspNet.Mvc" command. This will fix all your issues. :)
Hi,
I received this error when performing a manual upgrade from v7.2.4 to v7.3.1.
I ended up comparing the bin folder from the downloaded v7.3.1 against the upgraded site with the error and found that the download had fewer files. I resolved the issue by deleting the following files from the bin folder (just the dlls will have fixed it, but the pdb's aren't in the 7.3.1 release):
Thanks James!
I hit this one by overwriting an old site with a new one from my local box, and as you say must have resulted in some "orphan" assembly(ies) in the /bin which were still being loaded into the app domain and causing this error. I just deleted the bin and copied my fresh local copy up to the server and happy days. Cheers.
Same problem here after upgrading 7.2.1 to 7.3.2.
Thanks to James Wilkinson (see post above) I could fix this by removing Microsoft.Web.Helpers.dll and Microsoft.Web.Mvc.FixedDisplayModes.dll from the bin folder. The other files mentioned by James where not in my bin.
Thanks James!!
BTW: No VS and so no Nu-Get involved, I always do manual installs.
Just removing "Microsoft.Web.Helpers.dll" did the trick for me! =D
// m
Thanks Gerard & James. I had same problem upgrading from 7.1.2 to 7.4 manually.
Thanks Markus! Just removing "Microsoft.Web.Helpers.dll" did the trick for me too!
is working on a reply...