简体   繁体   English

File.WriteAllText()在带有IIS8的Server 2012中不起作用

[英]File.WriteAllText() not working in Server 2012 with IIS8

Code: 码:

string xml = sr.ReadToEnd();
string fileName = Server.MapPath("/") + "XML\\" + DateTime.Now.Ticks + ".xml";
EventLog.WriteEntry("HCC", "Writing to " + fileName);
File.WriteAllText(fileName, xml);

The EventLog entry gets written with the approperiate file name saying it's writing, but no file actually ever gets written. 用适当的文件名写入EventLog条目,表示正在写入,但实际上从未写入任何文件。

This is for a web listener, so I don't have the ability to run through the build on the server or locally to try to debug in VB. 这是针对Web侦听器的,因此我没有能力在服务器上或本地进行构建以尝试在VB中进行调试。

I have the file access set to Full Access for the IIS user. 我已将IIS用户的文件访问权限设置为“完全访问”。 What else may I be missing? 我还可能缺少什么?

Figured it out, it was the IIS_IUSRS permission set that was causing the problems. 弄清楚了,是导致问题的IIS_IUSRS权限集。 Even though the Application was running under another user, I assumed it'd use those permissions. 即使该应用程序在另一个用户下运行,我仍假定它会使用这些权限。 I was wrong. 我错了。

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

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