web-servicessecurity

Request for the permission of type 'System.Security.Permissions.FileIOPermission.. failed


I am getting this error when calling a web service method which writes to a file on the local drive on Windows 2003.

"System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."

I have done these steps:

So why is this web service still complaining about FileIOPermission? Fulltrust includes FileIOPermission.


Solution

  • After a lot of troubleshooting, it boiled down to a mistake I made in web.config where the location tag had a path of www.example.com but in IIS it was example.com!