Tuesday, January 28, 2014

Error after upgrading to ASP.NET MVC 5

After updating my NuGet packages to MVC 5, my website started to fail 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.”

If you see this error, it probably means that not everything is upgraded correctly inside your web project. Go have a look at 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 and carefully check if you applied all steps.

No comments: