开发者

starting a process from a .NET windows service

开发者 https://www.devze.com 2022-12-30 01:30 出处:网络
I am trying to start a c开发者_开发技巧onsole application from a .NET Windows Service. The service is runningon a Windows 2008 server.

I am trying to start a c开发者_开发技巧onsole 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 ..


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


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?


After a long time search for a solution for this, I found the wise stones for my problem.

I made a new WindowsForm based program, with same Process.Start command, and then the standard "Windows Warning Security" dialog box shows up, and thats why it dosent work.

After turn off "User Access Control" the Windows Service works correctly.

0

精彩评论

暂无评论...
验证码 换一张
取 消