System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib' failed

If you have an access to the IIS Manager (inetmgr), you can set the trust level of you application :

  • start > run > inetmgr
  • select your web site
  • click on ".NET Trust Levels"
  • select "Full Trust" in the drop down list

To change this configuration at a global level of your iis server use the following command line on the server :

appcmd set config /commit:WEBROOT /section:trust /level:Full

Here is the MSDN source for that info : http://technet.microsoft.com/en-us/library/cc753658(WS.10).aspx