Post

System.Security.SecurityException: Request for the permission of type ‘System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′ failed

This error can be caused by a variety of reasons. In my case I got it when I published my ASP.NET MVC 2 application to my local IIs instance in IIS 7.5 / Windows 7.

As it turns out, I needed to set the application pool account property “Load User profile” to true:

image

That did the trick.

This post is licensed under CC BY 4.0 by the author.