从.NET Windows服务启动流程流程、NET、Windows

2023-09-03 05:09:46 作者:安河桥北

我想开始从.NET Windows服务控制台应用程序。该服务在Windows 2008服务器上运行。

我用的Process.Start运行控制台应用程序,它运行(我可以看到它在任务经理),但我从来没有得到的进程id背部和调用的Process.Start只是挂起。 如果我运行从我的Windows 7计算机相同的服务的过程中运行,我得到的进程ID后面没有问题。

我很困惑。

解决方案

我有完全同样的问题。对我来说,关键是要设置StartInfo.UseShellExecute = FALSE;

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.

Windows7系统开启Telnet服务方法图文教程

I am confused ..

解决方案

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