简体   繁体   English

访问被拒绝以我的C#WCF WebService写入文件

[英]Access denied to write a file with my C # WCF webService

I hosted a WCF web Service on my server Windows 2008 R2 . 我在服务器Windows 2008 R2上托管了WCF Web服务。 Everything works perfectly on my localhost project Visual Studio 2012 . 一切都可以在我的本地主机项目Visual Studio 2012上完美运行。

However, once deployed on my server. 但是,一旦部署在我的服务器上。 My application throws an exception when my WCF trying to save an XML file in the C:\\. 当我的WCF尝试将XML文件保存在C:\\中时,我的应用程序引发异常。

I immediately think it came from a permissions problem. 我立即认为它来自权限问题。 I've tried adding rights in writings on the user IUSR but it changed nothing. 我曾尝试在用户IUSR上添加著作权,但并没有改变。 I even tried to apply all the rights to the user "Everyone". 我什至尝试将所有权利都应用到用户“所有人”。 But without success! 但是没有成功! An idea ? 一个主意 ? thanks 谢谢

Here's screenshots of on the configuration of my project: 这是我的项目配置的屏幕截图:

在此处输入图片说明

在此处输入图片说明

Code that throws the exception: 引发异常的代码:

XmlTextWriter myXmlTextWriter = new XmlTextWriter("c:/world.xml", null);

Why are you saving to the root drive folder? 为什么要保存到根驱动器文件夹? What happens when you try and save to for example C:\\Stuff ? 当您尝试保存到例如C:\\Stuff时会发生什么?

If this isn't running as something like Network Service I would hazard a guess it's because of something like UAC which will prevent you from writing to certain places considered restricted. 如果这不能像Network Service那样运行,我可能会猜测是由于诸如UAC之类的东西,它会阻止您写入某些被认为受限制的地方。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM