Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试写入日志文件,但File.Write(path, string)没有给我访问权限。
File.Write(path, string)
这是错误消息:
Access to the path 'C:\Windows\SysWOW64\inetsrv\20130213190451765 49cb4a74-de61-49e5-93de-94d982073f89.txt' is denied.
路径是通过给出的Server.MapPath("~")。在大多数情况下,我建议不要使您网站的根文件夹可写。为什么不选择一个不同的、隔离的位置并为您的应用程序池身份授予该位置的写入权限?
Server.MapPath("~")