Aspnethosting permission failed in new IIS7 websites02/08/2010
Recently at Dirigo we upgraded to Windows 7, and of course with Windows 7 comes IIS7. Operation is fairly normal except when I make new websites now I receive this error:
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=22.214.171.124, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
This is obviously a permission related error. I found many solutions online relating to people using the Code Access Security Policy Tool (Caspol.exe) to fix this issue. However all of their problems were related to running their websites on UNC or other netowrk shares. I tried re-registering asp.net with IIS, rebooting, trying all of the app pool settings, nothing seemed to work.
My Solution: Since the application pool asociated with a new website in IIS7 is created automatically, I deduced that this app pool was missing a particular permission. By switching my applications app pool to the default IIS app pool, the application would then execute properly.