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?