I have a WCF service which will will be called from mobile devices and that service will zip some folders in the machine and will send it back to the caller.I use dotnet zip for zipping the folders in my WCF service.
I am getting the following error trace from the open source dotnet utility , that i have used in my project.
“Request for the permission of Type ‘System.security.Permissions.FileIOpermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublickeyToken=dfsdfsdfsdfds’ Failed”
I am using the dotnet zip utility to zip my folders and files avaiable in my machine.
I tired one option, by cleaning the solution and building it with Administratice privilege it started working but after sometime the same problem comes again.
Please help me in resolving this.
I don’t know which WCF hosting option is your choice, but if this is Internet Information Services, it seems that these are some reasons of having this exception:
1) IIS worker process doesn’t have permissions over the folders to zip or the temporary folder where you place the Zip file that the service sends.
2) Web configuration has a very low trust in service code. Check that this is in medium or full-trust mode.
3) The way you’re opening the file is wrong. Check how you open the file stream and see if this is doing with the necessary file mode (OpenRead or like this).
I don’t think this is a compilation problem. It’s a run-time issue.