简体   繁体   English

如何从 Windows 服务访问连接到本地网络上路由器的 USB 驱动器

[英]How to access a USB drive attached to router on local network from windows service

I can't figure out how to access a network drive from a windows service.我不知道如何从 Windows 服务访问网络驱动器。 I know its a permission issue, but can't figure it out.我知道这是一个权限问题,但无法弄清楚。

string[] newFiles = Directory.GetFiles(@"\\Router\Cloud\Data", "*.*", SearchOption.AllDirectories);

I have seen a bunch of ways to try and enter credentials in forums, but non have worked.我已经看到了很多尝试在论坛中输入凭据的方法,但都没有奏效。 There is NO domain, just a local network.没有域,只有本地网络。

How do I pass credentials for the router username and password when I am running as the service account.当我作为服务帐户运行时,如何传递路由器用户名和密码的凭据。

It turns out you can goto the service created and right click and choose properties.事实证明,您可以转到创建的服务并右键单击并选择属性。

In there you can set the user account you want the service to use.在那里您可以设置您希望服务使用的用户帐户。

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

相关问题 无法从 Windows 服务访问驱动器映射网络共享上的文件 - Cannot access files on drive mapped network share from a Windows service 如何从 Windows 服务 map 网络驱动器 - How can I map a network drive from a Windows Service 如何从Windows服务映射网络驱动器? - How does one map network drive from windows service? Windows服务写入网络驱动器时获取访问被拒绝的异常 - Windows Service getting access denied exception while writing to Network Drive 运行windows服务时无法访问网络驱动器 - Can't access the network drive while running the windows service 如何检查所选路径是来自USB还是网络驱动器? - How to check if the chosen path comes from USB or network drive? 获取USB驱动器名称附加到Windows ce设备 - Getting USB drive name attached to windows ce device 如何在Windows Universal App中显示网络文件夹或本地驱动器中的图像 - How to display an image from a network folder or local drive in a Windows Universal App 使用来自一个 Windows 服务的本地系统和网络资源 - Using Local System and Network resources from one Windows Service 使用 windows 服务和 c# 检测 USB 驱动器插入和移除 - Detecting USB drive insertion and removal using windows service and c#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM