System.Diagnostics.Process.Start () cannot start a process when called from a Windows service

I am trying to start an external process from a .NET Windows service. I used to use overloading Process.Start(), which takes an executable path and command line. It works. But now I would like to start the process and run it in the context of a specific user. Therefore i call this versionStart()

public static Process Start(
    string fileName,
    string userName,
    SecureString password,
    string domain)

However, when I call the method, the application I'm trying to run throws an unhandled exception:

The application failed to initialize properly (0xc0000142). Click on OK to terminate the application.

I tried to run different applications, and they all throw the same exception. I ran the code outside of the Windows service and the application starts correctly.

So, is there a way to make this work in a windows service?

+3
4

, " ". " ". / " ".

+2

. , . . .

+2

It is just a shot in the dark, but perhaps you can try to start the Windows service interactively. If this works, it cannot be done in Windows Vista (due to session isolation 0).

+1
source

Use Filemon and see if it tries to open the configuration file and not find it. I once received this error due to an incorrect configuration.

0
source

All Articles