I am trying to create a directory and then write to it via an asmx web service. It works fine on my dev pc, but when I publish the service to the server, I keep getting access denied errors. I have gone in to IIS and made sure the service has write privileges. I also gave write access to all users, but am still getting the same error. Any suggestions?
Additional info Well, I solved the problem. When I called
Directory.CreateDirectory(directoryName);
it worked fine on my development box but blew up on the server. I needed to use
Directory.CreateDirectory(Server.MapPath(directoryName));
which worked fine on both.
For anyone searching. The following code did the trick:
If you're getting an access denied error, then it's an access denied error, period. It doesn't matter that it's happening from a web service. Diagnose it as you would diagnose any other access denied error.
My first suggestion is to make sure the IIS user account has access to the directory.
Next I would say double check your code. Are you trying to write to a directory that isn't there? Did you forget to change a config setting.
99% when I have had the same issues, it is usually a permissions issue.
you need to give "Network Service" write permission for that directory. Please check which OS you are useing also. It may need a different account.