C
chad
Hi,
I am using Process.Start() to call a console application from ASP.NET
page. When the code is executed, the Console application is opened.
When it is done, it should have been terminated but it is not. I have
placed WaitForExit(20000) to limit the execution time to 20 seconds and
if it does not terminate then it will be forced close. The question is
why wouldn't the application exit by itself when it is done as it
should be (it was idle). Please see the code below.
System.Diagnostics.ProcessStartInfo processInfo = new
System.Diagnostics.ProcessStartInfo(path, parameters);
processInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
processInfo.RedirectStandardOutput = true;
processInfo.UseShellExecute = false;
processInfo.CreateNoWindow = true;
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo = processInfo;
process.Start();
process.WaitForExit(20000);
process.Kill();
Thanks!!
I am using Process.Start() to call a console application from ASP.NET
page. When the code is executed, the Console application is opened.
When it is done, it should have been terminated but it is not. I have
placed WaitForExit(20000) to limit the execution time to 20 seconds and
if it does not terminate then it will be forced close. The question is
why wouldn't the application exit by itself when it is done as it
should be (it was idle). Please see the code below.
System.Diagnostics.ProcessStartInfo processInfo = new
System.Diagnostics.ProcessStartInfo(path, parameters);
processInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
processInfo.RedirectStandardOutput = true;
processInfo.UseShellExecute = false;
processInfo.CreateNoWindow = true;
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo = processInfo;
process.Start();
process.WaitForExit(20000);
process.Kill();
Thanks!!