ASP.NET Security Exception when Switch IIS7 to Use UNC Path for Content

Posted by Jeremy H. on Server Fault See other posts from Server Fault or by Jeremy H.
Published on 2010-05-17T13:20:12Z Indexed on 2012/04/09 11:32 UTC
Read the original article Hit count: 504

I have a Windows Server 2008 R2 box running IIS7.5 with Medium Trust configured for ASP.NET. When I have the website running from local content (e.g.: c:\inetpub\wwwroot) everything works fine. When I change IIS to use a UNC path for the content (e.g.: \\computer\wwwroot) I get the following error:

Security Exception 
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.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

I'm trying to figure out why ASP.NET/IIS would allow for the SQL call when using local content but not when using a UNC path. Any ideas what I need to do to use a UNC path from IIS7 properly?

© Server Fault or respective owner

Related posts about windows-server-2008

Related posts about iis7