访问指定的文件被禁止!

leoAAAA 2005-10-08 06:11:14
我在windows xp下写的程序运行正常,放到windows 2003server上就报错了,具体情况如下

我有一个日志记录,记录访问信息.可是总是说访问该文件被禁止,错误信息如下,我也按照提示将该目录授权改过了,还是不行. 请教各位可有解决办法,谢谢!

Access is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access is denied.

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access
...全文
110 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
leoAAAA 2005-10-09
  • 打赏
  • 举报
回复
谢谢各位了,揭帖了.只是不太清楚这两种方法哪种更安全
8u9 2005-10-09
  • 打赏
  • 举报
回复
xp和2000下用everyone就可以了,2003的没有用过,只能帮顶了。
triffang 2005-10-09
  • 打赏
  • 举报
回复
Mark
leoAAAA 2005-10-09
  • 打赏
  • 举报
回复
说得好,大概明白你的意思了,能把这二种方法再详细的说一下吗?或者在哪里可以找到这方面的参考资料,多谢!
zyizyizyi 2005-10-08
  • 打赏
  • 举报
回复
对那个有文件的目录添加network services安全组,该安全组的权限设为fullcontrol。
增加账户ASP.NET 对该文件所在的文件夹的访问权限是没有用的。除非你在web.config中加入<identity impersonate="true"/>, 否则进程启动的是一个匿名用户,并非你想的那个asp.net用户。或者在2003 server中设置一个其他的应用程序池。然后对那个设权限也是可以的。
leoAAAA 2005-10-08
  • 打赏
  • 举报
回复
非常感谢,我的数据库和程序都移过去了,那些用户我也都删除重新创建了,我不但增加了asp.net对该文件夹的访问权,而且也设置为everyone fullcontrol,但是还是不行.
ChengKing 2005-10-08
  • 打赏
  • 举报
回复
你只是数据库附加到另一个操作系统上了,但是用户权限没有重新设定

附加后的数据库在“数据库”=>"用户"栏也会显示一些用户,但那是假象,得删除重新建立
gdeljyh 2005-10-08
  • 打赏
  • 举报
回复
增加账户ASP.NET 对该文件所在的文件夹的访问权限

62,254

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧