3

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?

Brett McCann
  • 2,469
  • 2
  • 27
  • 44
  • Just to clarify your UNC notation...do you really mean "//machine_name/share_name/directory/runme.exe" or "\\machine_name\share_name\directory\runme.exe" ? – Kev Sep 25 '08 at 17:50
  • should be \'s you can tell my preferred environment.... ;) – Brett McCann Sep 25 '08 at 17:56

4 Answers4

3

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.

Rob Walker
  • 46,588
  • 15
  • 99
  • 136
1

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.

StingyJack
  • 19,041
  • 10
  • 63
  • 122
0

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

This should help.

Dustin
  • 51
  • 4
0

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

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794