Asp.net加载文件遇到“访问路径”被拒绝”正在 Windows 7 上开发
我有一个 Asp.net 应用程序,它只读取 xml 文件,这段代码过去在 Vista 和 VS2008 上运行良好,现在我刚刚迁移到 Windows 7,并将代码迁移到 VS2010,我遇到了“访问路径 [路径到我的 webapp 文件夹] 被拒绝”。没有其他任何改变,我尝试更改文件夹权限,尽管我认为这与此没有任何关系,因为相同的代码过去工作正常,但仍然没有解决这个问题问题。
有人可以解释一下为什么会发生这种情况以及如何解决它吗?
谢谢, 射线。
I have an Asp.net app that simply reads an xml file and this code used to work fine on Vista with VS2008, now I just moved to Windows 7 and I migrated the code to VS2010, I encoutered “Access to the path [path to my webapp folder] is denied". Nothing else is changed, I tried to change folder perms even though I didn't think it got anything to do with that since the same code used to work fine, but still didn't get around this problem.
Could someone please shed some light on why this may be happening and how to fix it?
Thanks,
Ray.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Visual Studio 内置 Web 服务器在部分信任的安全沙箱中运行,该沙箱对特定文件和路径具有有限的权限。不知何故,您尝试访问的路径和/或文件超出了沙箱的权限。
您可以尝试通过在 web.config 中添加或修改此设置来将 Web 服务器沙箱的安全级别设置为完全信任:
请注意,这不应在实时服务器上使用。在这种情况下,您应该在 IIS 和使用文件夹权限中设置正确的权限。
The Visual Studio built-in webserver runs in a partial-trust security sandbox, which has restricted permissions on specific files and paths. Somehow the path and/or file you are trying to access are outside the sandbox's permissions.
You could try to set the security level of the webserver sandbox to full trust by adding or modifying this in your web.config:
Please note that this should not be used on a live server. In that case, you should set the correct permissions both in IIS and using folder permissions.