Trying to get a Windows Service to run an executable on a shared drive

流过昼夜 提交于 2019-12-20 02:16:20

问题


I have c# that will run in a windows service. I'm trying to use the Process and ProcessStartInfo classes to run an executable. If the executable is on the local drive, no problem. However, I need to run an executable on a shared drive. I've tried using the UNC notation (//machine_name/share_name/directory/runme.exe), but the process seems to hang. The service and shared drive are on Windows XP. Has anyone tackled this issue before?


回答1:


The account your service is running as likely does not have permission to access the shared drive. Try configuring it to run as a user with permission to the network via the services applet. Right click on the service, choose properties and set the account in the login tab.




回答2:


What account is the service running as?

LocalSystem will only allow access to the local file system. If you want to access a network resource, you will have to run the service as a domain or network user.




回答3:


Have a look at this: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=471168&SiteID=1

This should help.




回答4:


If the app on the shared drive is a .Net app, make sure it has sufficient trust.



来源:https://stackoverflow.com/questions/134805/trying-to-get-a-windows-service-to-run-an-executable-on-a-shared-drive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!