Windows 7 x64 and IIS 7.5: AspNetHostingPermission Error
September 30, 2009 5 Comments
Quick Fix
I’m running Windows 7 Ultimate x64 on my laptop. I was setting up a downloaded code sample from the inimitable Rick Strahl and got this:
Exception Details: System.Security.SecurityException: Request for the permission of type ‘System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′ failed.
After much Googling, discovered this:

If that setting is blank, it’s trying to use “pass-through credentials,” which I assume is Anonymous access. I tried to get anonymous working by adding the IUSR account to that folder, but no luck. Obviously this isn’t the way you’d set things up in production but it works for my dev machine. Hope this saves someone some time.