Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

starting a process from a .NET windows service

I am trying to start a console application from a .NET Windows Service. The service is running on a Windows 2008 server.

I use Process.Start to run the console application and it runs( I can see it in the task mgr), but I never get the process id back and the call to Process.Start just hangs. If I run the same service from my Windows 7 machine the process runs and I get the process Id back no problem.

I am confused ..

like image 644
G-Man Avatar asked May 07 '10 16:05

G-Man


2 Answers

I had exactly this same problem. For me the key was to set StartInfo.UseShellExecute = false;

like image 84
BrettRobi Avatar answered Oct 20 '22 03:10

BrettRobi


Is it possible that the process you are spawning is attempting to prompt the window station for user input? In which case it could hang...

Which process are you starting? Is it part of the platform/OS (like cmd.exe) or something custom?

like image 33
LBushkin Avatar answered Oct 20 '22 03:10

LBushkin