[英]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.