WebClient.Download()异常:访问路径
我有一个非常简单的代码:
WebClient webClient = new WebClient();
webClient.DownloadFile(privateHTML, @"\\192.168.0.12\imagedepot\AT" + carID + ".jpeg");
但是,我收到错误:
访问路径“\\192.168.0.12\imagedepot\AT296866482.jpeg”被拒绝。
我可以从我的机器(运行该应用程序的机器)浏览此文件夹,右键单击并创建新的文本文件。目标是Windows 2008服务器。有什么想法吗?该文件夹共享设置为每个人都有完整的。
当我将 \192.168.0.12\imagedepot 更改为 Z:\ 的映射驱动器时,我得到了。
找不到路径“Z:\AT294577469.jpeg”的一部分
有什么想法吗?
I have a very simply code of:
WebClient webClient = new WebClient();
webClient.DownloadFile(privateHTML, @"\\192.168.0.12\imagedepot\AT" + carID + ".jpeg");
However, i get the error:
Access to the path '\\192.168.0.12\imagedepot\AT296866482.jpeg' is denied.
I can browse this folder from my machine (same one this app runs on), right click and create new text file. The target is a windows 2008 server. Any ideas? That folder share is set to everyone with full.
When I change \192.168.0.12\imagedepot to be a mapdrive of Z:\ i get.
Could not find a part of the path 'Z:\AT294577469.jpeg'
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
评论后编辑:
那么这可能是一个权限/权利问题......它是什么类型的应用程序?赢形式? Windows 服务? ASP.NET?
编辑2:
现在OP已经澄清了它是一个Windows服务,问题就很清楚了:
从服务访问网络驱动器/UNC 路径绝对是一个权限/权利问题,因为服务通常不允许访问网络共享和/或映射驱动器!
请参阅映射网络服务使用的驱动器
EDIT after comment:
Then this is perhaps a permissions/rights issue... what sort of application is it ? WinForms ? Windows Service ? ASP.NET ?
EDIT 2:
Now that it is clarified by the OP (see comments) that it is a Windows Service the problem is clear:
Accsessing Network drives/UNC paths from a service is definitely a permissions/rights issue as Service is usually NOT allwed to access a network share and/or a mapped drive!
see Map a network drive to be used by a service