简体   繁体   English

System.UnauthorizedAccessException:访问路径拒绝错误

[英]System.UnauthorizedAccessException: Access to the path denied error

I am using a 3rd party server and I am trying to upload an image to the server from my web form which I made in c# mvc.It works fine om my localhost and when I published it it give me an error 我正在使用第三方服务器,我正在尝试从我在c#mvc中创建的网络表单上传图像到服务器。我的本地主机工作正常,当我发布它时给我一个错误

System.UnauthorizedAccessException: Access to the path 'D:\InetPub\vhosts\abc.com\httpdocs\Images\Sections\Developer\ClientLogo\circle-small-empty.18x18.png' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at 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) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode) at System.Web.HttpPostedFile.SaveAs(String filename) at System.Web.HttpPostedFileWrapper.SaveAs(String filename) at ab.CorporateSite.Controllers.DeveloperController.ImagePath(HttpPostedFileBase imgfile).

Throgh filezilla I have checked the rights on the particualr folder o server where i want to save images (ClientLogo folder), acc. Throgh filezilla我已经检查了要保存图像的特定文件夹o服务器上的权限(ClientLogo文件夹),acc。 to that it has full rights and on my local system also I gave full rights to network service and everyone. 它拥有完整的权利,在我的本地系统上,我也享有网络服务和所有人的全部权利。

I am struggling with this problem since yesterday and nothing is working out.Please suggest me what should I do?? 我从昨天起就在努力解决这个问题,没有任何问题。请告诉我该怎么办?

You need to grant rights to the folder for the IIS application pool identity under which your application is running. 您需要为运行应用程序的IIS应用程序池标识授予该文件夹的权限。

The virtual user that needs the rights is typically IIS AppPool\\AppPoolNameGoesHere . 需要权限的虚拟用户通常是IIS AppPool\\AppPoolNameGoesHere

Add permissions to users/groups: 向用户/组添加权限:
In IIS Server go to your site -> Edit Permissions of folder -> Go to Security tab and grant permissions to appropriate users or groups. 在IIS服务器中,转到您的站点 - >编辑文件夹权限 - >转到“ 安全”选项卡,并向相应的用户或组授予权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 System.UnauthorizedAccessException:访问路径:拒绝PATH - System.UnauthorizedAccessException: Access to the path:PATH is denied UWP System.UnauthorizedAccessException:拒绝访问路径 - UWP System.UnauthorizedAccessException: Access to the path is denied System.UnauthorizedAccessException:拒绝访问路径“...” - System.UnauthorizedAccessException: Access to the path "..." is denied DotNetZip System.UnauthorizedAccessException:拒绝访问路径 - DotNetZip System.UnauthorizedAccessException: Access to the path is denied System.UnauthorizedAccessException:拒绝访问路径“...” - System.UnauthorizedAccessException: Access to the path '...' is denied System.UnauthorizedAccessException拒绝访问路径 - System.UnauthorizedAccessException Access to the path is denied System.UnauthorizedAccessException:访问路径被拒绝 - System.UnauthorizedAccessException: Access to the path denied System.UnauthorizedAccessException拒绝错误 - System.UnauthorizedAccessException Denied Error System.UnauthorizedAccessException:拒绝访问路径 (UWP C#) - System.UnauthorizedAccessException: Access to the path is denied (UWP C#) File.ReadAllText(): System.UnauthorizedAccessException: '访问路径被拒绝。' - File.ReadAllText(): System.UnauthorizedAccessException: 'Access to the path is denied.'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM