无法通过Asmx Web服务创建目录 [英] Can't create directory via asmx web service
问题描述
我正在尝试创建目录,然后通过asmx Web服务写入该目录.它在我的开发PC上可以正常工作,但是当我将服务发布到服务器时,我总是收到拒绝访问的错误.我已经进入IIS,并确保该服务具有写权限.我还向所有用户授予了写访问权,但仍然遇到相同的错误.有什么建议吗?
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));
两者都可以正常工作.
推荐答案
适用于任何正在搜索的人.以下代码可以解决问题:
For anyone searching. The following code did the trick:
Directory.CreateDirectory(Server.MapPath(directoryName));
这篇关于无法通过Asmx Web服务创建目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!