对路径“C:\Program Files\IIS Express\MicroblogInfo.xml”的访问被拒绝。

说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.UnauthorizedAccessException: 对路径“C:\Program Files\IIS Express\MicroblogInfo.xml”的访问被拒绝。 ASP.NET 无权访问所请求的资源。请考虑对 ASP.NET 请求标识授予访问此资源的权限。ASP.NET 有一个在应用程序没有模拟时使用的基进程标识(通常,在 IIS 5 上为 {MACHINE}\ASPNET,在 IIS 6 和 IIS 7 上为网络服务,在 IIS 7.5 上为配置的应用程序池标识)。如果应用程序正在通过 <identity impersonate="true"/> 模拟,则标识将为匿名用户(通常为 IUSR_MACHINENAME)或经过身份验证的请求用户。 To grant ASP.NET access to a file, right-click the file in File 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.源错误:
行 33: 行 34: XmlSerializer xs = new XmlSerializer(typeof(DataTable));行 35: System.Xml.XmlWriter fs = System.Xml.XmlWriter.Create("MicroblogInfo.xml");行 36: xs.Serialize(fs, dt);行 37: }
源文件: f:\毕业设计\代码\MyCoolBlogSys\UserPage.aspx.cs 行: 35 堆栈跟踪:
[UnauthorizedAccessException: 对路径“C:\Program Files\IIS Express\MicroblogInfo.xml”的访问被拒绝。] System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +10797222 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, Boolean useLongPath, Boolean checkHost) +1352 System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) +60 System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync) +54 System.Xml.XmlWriterSettings.CreateWriter(String outputFileName) +155 System.Xml.XmlWriter.Create(String outputFileName, XmlWriterSettings settings) +23 System.Xml.XmlWriter.Create(String outputFileName) +6 UserPage.Page_Load(Object sender, EventArgs e) in f:\毕业设计\代码\MyCoolBlogSys\UserPage.aspx.cs:35 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51 System.Web.UI.Control.OnLoad(EventArgs e) +92 System.Web.UI.Control.LoadRecursive() +54 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772

谁能解释这到底是为什么啊。程序所在文件夹的权限设置是这样设置的:

第1个回答  2014-01-24
检查该文件是否存在,存在则检查所用用户是否有该文件的访问权限,是否有程序需要的相关权限追问

我这是创建xml文件,根本不存在是不是存在文件的问题,而权限你也看了,.net的Net Service的权限我已经给了

追答

你是要创建这个文件?那你的这个文件所要在的文件夹存在吗?你是用什么方式创建的?是不是创建的方法有问题啊

本回答被提问者采纳
第2个回答  2014-01-25
你好,在你的web相关文件夹中添加internet来宾权限,希望对您有用,我的是xp系统没有那项,好像是iuser之类的用户,你在百度上搜索就出来了本回答被网友采纳

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网