从Windows服务调用时的Process.Start不工作工作、Windows、Process、Start

由网友(元气少女谢广坤)分享简介:在Windows 8的我正在运行的窗口服务。此服务是应该由On Windows 8 I am running a windows service. This service is supposed to start a program byProcess.Start(exePath);但是这个过程会立即退出 - 不...

在Windows 8的我正在运行的窗口服务。此服务是应该由

On Windows 8 I am running a windows service. This service is supposed to start a program by

Process.Start(exePath);

但是这个过程会立即退出 - 不执行的主要过程,即使第一线。之前,在Windows 7上运行相同的过程,相同的服务时,一切正常。

But the process exits immediately - even first line in the Main procedure is not executed. Before, when running the same process in same service on Windows 7, everything worked fine.

我怎样才能使它重新工作?如何正确地从一个窗口服务启动一个进程?

How can I make it work again? How to properly start a process from a windows service?

推荐答案

找到了解决办法。过程是这样开始:

Found the solution. Process has to be started like this:

ProcessStartInfo info = new ProcessStartInfo(exePath);
info.CreateNoWindow = true;
info.UseShellExecute = false;
Process.Start(info);

出于某种原因,创建一个shell窗口,在系统的后台时有问题,priviledges。

For some reason there are problems with priviledges when creating a shell window in the background of the SYSTEM.

阅读全文

相关推荐

最新文章