llasarov
llasarov

Reputation: 2111

Starting new process from ASP.NET fails

I'm trying to start a new process from my WCF Service. For that purpose I use

var process = Process.Start(
    new ProcessStartInfo { WorkingDirectory = config.WorkingDirectory,
                           FileName = config.WorkingDirectory,
                           Arguments = string.Format("{0} {1}", mpcName, jobId),
                           CreateNoWindow = false,
                           WindowStyle = ProcessWindowStyle.Hidden });

The WebApp is using a separate AppDomain whose Identity is set to a user account having administrator rights on the server.

Process.Start throws an exception telling

Server execution failed,    at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)

I also tested setting user and password in ProcessStartInfo. Specifying the password was quite tricky (SecureString) and then I received

The stub received bad data,    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)

so I skipped this way.

Do you know what is the reason for my problem and how I can fix it.

I forgot: I'm using Windows Server 2008 R2, IIS 7

Upvotes: 1

Views: 1744

Answers (2)

Joshua Evensen
Joshua Evensen

Reputation: 1566

This q/a helped me fix this issue in one of my projects, but different cause --

was trying to start process as a Domain user from an integration test being run by nCrunch. Turns out MY problem was a really long argument string.

(same argument string works with no user/password)

Environment is Windows 8, 64 bit.

Anyway, just gonna have to pass the arg data a different way.

Upvotes: 0

llasarov
llasarov

Reputation: 2111

I got it!

It's very strange but the only change needed was to invoke

Process.Start(exeFullPath, args);

Obviously the combination of ProcessStartInfo props is important.

Upvotes: 1

Related Questions