我正在尝试写入日志文件,但File.Write(path, string)
并未授予我访问权限。
这是错误消息:
Access to the path 'C:\Windows\SysWOW64\inetsrv\20130213190451765 49cb4a74-de61-49e5-93de-94d982073f89.txt' is denied.
答案 0 :(得分:1)
路径是通过Server.MapPath("~")
给出的。我建议不要在大多数情况下使网站的根文件夹可写。为什么不选择一个不同的,孤立的位置,并为该位置的应用池标识提供写入权限?