访问路径“”在C#中被拒绝

编程入门 行业动态 更新时间:2024-10-28 00:21:19
本文介绍了访问路径“”在C#中被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在C驱动器中有一个XML文件。我想更新并使用C#保存该xml。保存xml时会抛出错误。错误是 访问路径'C:\inetpub \wwwroot \sites\mysite \ App_Data \ roll.xml'被拒绝。如何诊断这个问题 谢谢, 问候, Ramadurai U

解决方案

信用转到ThePhantomUpvoter,因为他说你只需要更改你的权限,这样运行网站的用户就有权编辑文件......

更改IIS用户的权限,请按照以下步骤操作: http ://support.microsoft/kb/308419 [ ^ ]

如果这是Windows 7(或Vista),则此位置不合法。但是不要将其更改为D:,甚至可能不会更改权限。以合法的方式更好地使用目录。请参阅我过去的回答: 如何找到我的程序目录 [ ^ ]。 如果这是一个Web应用程序,则不能使用目录配置之外的任何目录作为站点的根目录。 Web应用程序在沙盒环境中运行,无论文件系统权限如何,都不允许访问项目目录树的大小。
-SA

Hi , I have a XML file in "C" Drive . I want to update and to save that xml using C#. While saving the xml it is throwing error. The error is "Access to the path 'C:\inetpub\wwwroot\sites\mysite\App_Data\roll.xml' is denied". How to diagnose this problem Thank you, Regards, Ramadurai U

解决方案

Credit goes to ThePhantomUpvoter, as he said you just need to change your permissions so that the user running the site will have permission to edit files...

Change the permissions for IIS user, follow this: support.microsoft/kb/308419[^]

If this is Windows 7 (or Vista) this location is not legal. But don't "change it to D:", and probably don't even change permissions. Better use the directories in a legitimate way. Please see my past answer: How to find my programs directory[^]. If this is a Web application, you cannot use any directories beyond the directory configures as the root directory for your site. Web applications are run in a sandboxed environment which won't allow access outsize of your project directory tree, regardless of the file system permissions.
—SA

更多推荐

访问路径“”在C#中被拒绝

本文发布于:2023-11-08 02:30:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1568080.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:路径   被拒

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!