Cannot create directory through asmx web service

I am trying to create a directory and then write it through the asmx web service. It works fine on my computer, but when I publish the service on the server, I always get denied access to errors. I went to IIS and made sure that the service has write permissions. I also gave write access to all users, but still getting the same error. Any suggestions?

Additional Information Well, I solved the problem. When i called

Directory.CreateDirectory(directoryName); 

It worked fine on my development box, but exploded on the server. I needed to use

 Directory.CreateDirectory(Server.MapPath(directoryName)); 
which worked great on both.
0
web-services asmx
source share
4 answers

For those who are looking. The following code did the trick:

 Directory.CreateDirectory(Server.MapPath(directoryName)); 
0
source share

My first suggestion is to make sure that 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 is not there? You forgot to change the configuration setting.

99% when I had the same problems, usually this is a permission problem.

+1
source share

If you get an access denied error, then this is an access denied error, period. It doesn't matter that this comes from a web service. Diagnose it, because you will diagnose any other error that denied access.

0
source share

you need to grant write permission to Network Service for this directory. Check which OS you are also using. A different account may be required.

0
source share

All Articles