访问路径...被拒绝 [英] Access to the path ... is denied

查看:165
本文介绍了访问路径...被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



i有c#内置的asp.net网络应用。



其中我我正在使用文件上传。



c #code

 string FilePath = Server.MapPath(FolderPath + FileName) ; 
FileUpload1.SaveAs(FilePath);





以上代码在本地计算机上工作正常但在发布Web应用程序之后域名,我在上传文件时收到此错误。



错误

访问路径'h :\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ 

描述:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.UnauthorizedAccessException:访问路径'h:\root \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -01-2015.xlsx'被拒绝。

ASP.NET无权访问所请求的资源。考虑将资源的访问权限授予ASP.NET请求标识。 ASP.NET具有基本进程标识(IIS 5上通常为{MACHINE} \ ASPNET,IIS 6和IIS 7上为网络服务,IIS 7.5上已配置的应用程序池标识),如果应用程序未模拟,则使用该标识。如果应用程序通过< identity impersonate =true/>进行模拟,则标识将是匿名用户(通常为IUSR_MACHINENAME)或经过身份验证的请求用户。

要授予对文件的ASP.NET访问权限,请在文件资源管理器中右键单击该文件,选择属性,然后选择安全选项卡。单击添加以添加适当的用户或组。突出显示ASP.NET帐户,并选中所需访问的框。





请帮助我。



谢谢

解决方案

在IIS中运行的应用程序

使用所谓的应用程序池标识运行。

这是默认值。



请阅读:

http://www.iis.net/learn/manage/configuring-security/application-pool-identities [< a href =http://www.iis.net/learn/manage/configuring-security/application-pool-identitiestarget =_ blanktitle =新窗口> ^ ]

如果你的应用程序池是DefaultAppPool

你必须为用户分配权限IIS AppPool \DefaultAppPool



你也可以分配不同的身份,例如本地系统

Hi guys,

i have asp.net web app built in c#.

where i'm using file to upload.

c# code

string FilePath = Server.MapPath(FolderPath + FileName);
                    FileUpload1.SaveAs(FilePath);



the above code is working fine on local machine but after publishing the web app on domain, i'm getting this error on uploading of file.

error

Access to the path 'h:\root\home\fgsons-001\www\root\gis\Files\GIS-25-01-2015.xlsx' 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 to the path 'h:\root\home\fgsons-001\www\root\gis\Files\GIS-25-01-2015.xlsx' 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 and IIS 7, and the configured application pool identity on IIS 7.5) 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 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.



plz help me.

Thanks

解决方案

An application running in IIS
runs with a so-called Application-Pool Identity.
This is the default.

Please read:
http://www.iis.net/learn/manage/configuring-security/application-pool-identities[^]
If your application pool is "DefaultAppPool"
you must assign rights to user "IIS AppPool\DefaultAppPool"

You can also assign a different identity e.g. LocalSystem


这篇关于访问路径...被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆