在文件夹中保存图像时的文件夹权限
问题描述:
我正在尝试上传图像并将其保存到名为dbImage的文件夹中.在本地主机上它正在工作,但是在当前服务器上它给出了一些权限错误...如
I am trying to upload the image and save it into the folder named as dbImage. on local host it was working but on current server it gives some permission error... as
<br />
"Access to the path <br />
''D:\PLESKVHOSTS\vhosts\hoteldeluxe.com\httpdocs\dbImage\285680_341433335924712_1150059646_a.jpg'' is denied."<br />
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.<br />
<br />
To grant ASP.NET access to a file, right-click the file in 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."<br />
我已经为所有人提供了对该文件夹的完全控制权,但我仍然面临相同的问题
I have already provide everyone access wih full control to this folder still i am facing the same problem
答
此问题是由于文件夹访问权限所致.当您在IIS上托管应用程序时,它将在名为IUSER_machine的用户名下运行,它具有非常有限的访问权限,而在使用Visual Studio在本地计算机上运行代码的同时,Visual Studio将在对文件夹具有完全访问权限的本地admin用户下运行.
用于在服务器上运行应用程序
D:\ PLESKVHOSTS \ vhosts \ hoteldeluxe.com \ httpdocs \ dbImage
需要以下用户的权限
-IUSER_machin名称
-ASPNET
右键单击文件夹,然后转到共享和安全性
在安全性"选项卡中,添加提供的用户并为该用户提供完全访问权限.
Hi,
This issue is due to permission of the folder access. when you host your application on IIS it will run under the user called IUSER_machine name it has very restricted access, where as while running the code on the local machine with visual studio which will run under the local admin user which has complete access for the folders.
For running the application on the server
D:\PLESKVHOSTS\vhosts\hoteldeluxe.com\httpdocs\dbImage
needs the permission for the following users
- IUSER_machin name
- ASPNET
Right click on the Folder and go to sharing and security
in Security Tab add the provided users and and provide the full access for this users.