当前位置: 代码迷 >> ASP.NET >> asp.net 访问本地机目录失败:Access to the path . is denied.该如何处理
  详细解决方案

asp.net 访问本地机目录失败:Access to the path . is denied.该如何处理

热度:10862   发布时间:2013-02-25 00:00:00.0
asp.net 访问本地机目录失败:Access to the path ...... is denied.
asp.net 一个发布系统,将信息发布到本地机的静态 html 页,虚拟路径是 ntfs 格式

但是好象不能访问本地机目录,老是报一个错误:

Access to the path 'D:\Web\wwwroot\Wedding\BBS\Bulletins\Recruit_00364.htm' is denied.
  at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
  at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, 

Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, 

SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
  at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare 

share, Int32 bufferSize, FileOptions options)
  at System.IO.StreamWriter.CreateFile(String path, Boolean append)
  at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 

bufferSize)
  at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding)
  at Transactions.Wedding.Forum.ForumManager.PublishRecruitBulletin() in D:\MyCodes\fd1

\Wedding\Transactions\Wedding\Forum\ForumManager.cs:line 239

------解决方案--------------------------------------------------------
找到不能访问的那个目录,右击选择安全,添加一个everyone用户,然后将其权限设置为“完全控制”,再看看报错不?
------解决方案--------------------------------------------------------
找到不能访问的那个文件夹,设置允许.net完全控制,试一试,不行就重新启动一下机器
  相关解决方案