System.Security.SecurityException when connecting to remote database from IIS7

Problem

I have a web service running on Windows Sever 2008 R2 using IIS7 trying to connect to a remote database and keep getting the following exception:
System.Security.SecurityException was unhandled by user code
Message=Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Source=mscorlib
StackTrace:
      at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
      at System.Security.CodeAccessPermission.Demand()
      at System.Reflection.Assembly.VerifyCodeBaseDiscovery(String codeBase)
      at System.Reflection.Assembly.GetName(Boolean copiedName)
      at BCU.Framework.Exception.BCUApplicationException..ctor(String message, Exception inner, TraceLevel ServiceMethodTraceLevel, NameValueCollection CircumstanceInformation)
      at BCU.Framework.Exception.BCUExceptionManager.CreateSystemException(Exception Exception)
      at BCU.Application.WebBanking.WebBankingLoginData.IsWebBankingAvailable()
      at BCU.ValidateInformation.IsWebBankingAvailable()
      at BCU.Framework.Security.LoginServices.IsWebBankingAvailable()
InnerException:

Solution

Adjust the .NET Trust Levels of the virtual directory hosting your web service.  To begin you must start IIS Manager and locate the application.  From the Features View pain double click the .NET Trust Levels icon. Ensure that the web.config for the application is not read only and select the desired Trust Level then click Apply.

Add comment

Loading