在Asp.net 中加载.xml文件中的内容,可一运行是就显示:
“/WebApplication2”应用程序中的服务器错误。
--------------------------------------------------------------------------------对路径“c:\inetpub\wwwroot\WebApplication2\Entries\Entry.xml”的访问被拒绝。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.UnauthorizedAccessException: 对路径“c:\inetpub\wwwroot\WebApplication2\Entries\Entry.xml”的访问被拒绝。 ASP.NET 未被授权访问所请求的资源。请考虑授予 ASP.NET 请求标识访问此资源的权限。ASP.NET 有一个在应用程序没有模拟时使用的基进程标识(通常,在 IIS 5 上为 {MACHINE}\ASPNET,在 IIS 6 上为网络服务)。如果应用程序正在通过 <identity impersonate="true"/> 模拟,则标识将为匿名用户(通常为 IUSR_MACHINENAME)或经过身份验证的请求用户。 若要授予 ASP.NET 对文件的写访问权,请在资源管理器中右击该文件,选择“属性”,然后选择“安全”选项卡。单击“添加”添加适当的用户或组。突出显示 ASP.NET 帐户,选中所需访问权限对应的框。源错误:
行 40: string filepath=EntryFilePath+"\\"+filename;
行 41: //open the file
行 42: FileStream file=new FileStream(filepath,FileMode.Open);
行 43: //create the serializer
行 44: XmlSerializer serializer=new XmlSerializer(typeof(Entry));
源文件: c:\inetpub\wwwroot\webapplication2\global.asax.cs 行: 42 堆栈跟踪:
[UnauthorizedAccessException: 对路径“c:\inetpub\wwwroot\WebApplication2\Entries\Entry.xml”的访问被拒绝。]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) +888
System.IO.FileStream..ctor(String path, FileMode mode) +52
WebApplication2.Global.LoadEntry(String filename) in c:\inetpub\wwwroot\webapplication2\global.asax.cs:42
WebApplication2._Default.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\webapplication2\default.aspx.cs:35
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
可它提示的错误跟本解决不了,望哪们高手指点迷经.
“/WebApplication2”应用程序中的服务器错误。
--------------------------------------------------------------------------------对路径“c:\inetpub\wwwroot\WebApplication2\Entries\Entry.xml”的访问被拒绝。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.UnauthorizedAccessException: 对路径“c:\inetpub\wwwroot\WebApplication2\Entries\Entry.xml”的访问被拒绝。 ASP.NET 未被授权访问所请求的资源。请考虑授予 ASP.NET 请求标识访问此资源的权限。ASP.NET 有一个在应用程序没有模拟时使用的基进程标识(通常,在 IIS 5 上为 {MACHINE}\ASPNET,在 IIS 6 上为网络服务)。如果应用程序正在通过 <identity impersonate="true"/> 模拟,则标识将为匿名用户(通常为 IUSR_MACHINENAME)或经过身份验证的请求用户。 若要授予 ASP.NET 对文件的写访问权,请在资源管理器中右击该文件,选择“属性”,然后选择“安全”选项卡。单击“添加”添加适当的用户或组。突出显示 ASP.NET 帐户,选中所需访问权限对应的框。源错误:
行 40: string filepath=EntryFilePath+"\\"+filename;
行 41: //open the file
行 42: FileStream file=new FileStream(filepath,FileMode.Open);
行 43: //create the serializer
行 44: XmlSerializer serializer=new XmlSerializer(typeof(Entry));
源文件: c:\inetpub\wwwroot\webapplication2\global.asax.cs 行: 42 堆栈跟踪:
[UnauthorizedAccessException: 对路径“c:\inetpub\wwwroot\WebApplication2\Entries\Entry.xml”的访问被拒绝。]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) +888
System.IO.FileStream..ctor(String path, FileMode mode) +52
WebApplication2.Global.LoadEntry(String filename) in c:\inetpub\wwwroot\webapplication2\global.asax.cs:42
WebApplication2._Default.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\webapplication2\default.aspx.cs:35
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
可它提示的错误跟本解决不了,望哪们高手指点迷经.
IIS—WPG