I am trying to execute an EXE (cmd.exe to be exact) on the web server using an asp.net web page. When I execute the EXE on a server 2003 box with IIS 6.0 it works fine. When I try to execute it on a server 2008 box with IIS 7.0, I receive this error in the Application Event Log (no error is caught by my program):
"Faulting application cmd.exe, version 6.0.6001.18000, time stamp 0x47919317, faulting module kernel32.dll, version 6.0.6001.18000, time stamp 0x4791adec, exception code 0xc0000142, fault offset 0x00000000000b1188, process id 0x10ec, application start time 0x01c98c5d97fde641."
Because it works on the IIS 6.0 box, I immediately think that I may have to configure something in IIS 7.0's configuration to allow the running of an EXE from an ASP.net page. Any ideas?
Just in case, here is the code:
StreamReader sr = null;
ProcessStartInfo psi = null;
try {
psi = new ProcessStartInfo("cmd.exe", "ping 10.147.0.132");
psi.RedirectStandardOutput = true;
psi.RedirectStandardInput = true;
psi.RedirectStandardError = true;
psi.Domain = "domain";
psi.UserName = "username";
psi.Password = password;
psi.UseShellExecute = false;
//start the process
Process p = Process.Start(psi);
p.WaitForExit();
sr = p.StandardOutput;
//put output to message
lblMessage.Text = "Result: " + sr.ReadToEnd();
} catch (Exception ex) {
lblMessage.Text = ex.Message;
}
Is there a better forum for my question?
Thanks.
Zach