I'm getting this exception when I browse a precompiled version of my ASP.NET 2.0 site. I am signing with a .snk and AllowPartiallyTrustedCallers is enabled.
System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Any ideas?
-
-
mrichman wrote:I'm getting this exception when I browse a precompiled version of my ASP.NET 2.0 site. I am signing with a .snk and AllowPartiallyTrustedCallers is enabled.
System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Any ideas?
First steps;
Have you tweaked machine.config?
Is this a ported 1.1 app?
Are you accessing any external assemblies which are hosted outside of your IIS web root?
Does the user your app pool is running under have Read & Execute, List and Read permissions to the framework dir and full control to the temporary asp.net files directory under that (yes, I know it shouldn't be needed in precompiled apps) and full control to %TEMP%?
Is any type of authenication turned on?
-
Yes, I've tweaked machine.config since this is a shared hosting environment.
This is not a ported 1.1 app -- 2.0 from scratch.
All the assemblies I reference are either in the GAC or in \bin.
The AppPool runs as a priviledged user account.
I use forms auth and the web app is set to impersonate a priviledged user via web.config.
Also, this app works 100% fine when *NOT* precompiled. -
I have found that you can get this error when you set IIS to a network or shared drive instead of the root drive or directory.
Go into IIS and then into the properties of the web site you are working on and select the Home Directory tab.
Choose:
When connecting to this resource, the content should come from:
2) A directory on this computer
Browse for the folder holding your website on the actual drive it is located on and select it.
This will update the location of the web.config file on the ASP.Net tab and will resolve correctly.
I hope this helps!
Critt -
There is no "actual drive" as this code runs off a UNC path to a CIFS share on my NetApp. Maybe I just need to tweak security.config?
-
mrichman wrote:There is no "actual drive" as this code runs off a UNC path to a CIFS share on my NetApp. Maybe I just need to tweak security.config?
If you haven't resolved this yet... yes, it's to do with code access security when using a unc.
I found a nice little article on this, with pictures (I *LOVE* articles with pictures
)
http://www.15seconds.com/issue/040121.htm
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.