A
Alexander van Doormalen
I am trying to run an external process (command tool) within a Windows
Service with the specified account. When the application launches I get
a error dialog with the following message:
Application popup: <COMMAND TOOL> - Application Error : The application
failed to initialize properly (0xc0000142). Click on OK to terminate
the application.
I use the following code to start the process (not relevant code is
stripped):
using (Process commandTool = new Process())
{
ProcessStartInfo startInfo = commandTool.StartInfo;
startInfo.FileName = commandToolPath;
startInfo.Arguments = arguments;
startInfo.UseShellExecute = false;
startInfo.RedirectStandardError = true;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardInput = true;
startInfo.CreateNoWindow = true;
startInfo.Domain = domain;
startInfo.UserName = username;
startInfo.Password = password;
commandTool.Start(); // -> Fails here with error dialog!
if (!commandTool.HasExited)
{
int timeout = this.configuration.QuotaCommandToolTimeout;
if (timeout > 0)
{
commandTool.WaitForExit(timeout); // With configured timeout
}
else
{
commandTool.WaitForExit(); // Without timeout
}
}
string errorOutput = commandTool.StandardError.ReadToEnd();
string infoOutput = commandTool.StandardOutput.ReadToEnd();
}
When starting the process without the account information it starts
fine only it doesn't work, as I need a domain service account.
Anybody has a idea how to solve this?
Service with the specified account. When the application launches I get
a error dialog with the following message:
Application popup: <COMMAND TOOL> - Application Error : The application
failed to initialize properly (0xc0000142). Click on OK to terminate
the application.
I use the following code to start the process (not relevant code is
stripped):
using (Process commandTool = new Process())
{
ProcessStartInfo startInfo = commandTool.StartInfo;
startInfo.FileName = commandToolPath;
startInfo.Arguments = arguments;
startInfo.UseShellExecute = false;
startInfo.RedirectStandardError = true;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardInput = true;
startInfo.CreateNoWindow = true;
startInfo.Domain = domain;
startInfo.UserName = username;
startInfo.Password = password;
commandTool.Start(); // -> Fails here with error dialog!
if (!commandTool.HasExited)
{
int timeout = this.configuration.QuotaCommandToolTimeout;
if (timeout > 0)
{
commandTool.WaitForExit(timeout); // With configured timeout
}
else
{
commandTool.WaitForExit(); // Without timeout
}
}
string errorOutput = commandTool.StandardError.ReadToEnd();
string infoOutput = commandTool.StandardOutput.ReadToEnd();
}
When starting the process without the account information it starts
fine only it doesn't work, as I need a domain service account.
Anybody has a idea how to solve this?