![]() |
|
|
|||||||
![]() |
ASP Net - Console application hangs when called from Process.Start |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
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!! chad |
|
|
|
|
#2 |
|
Posts: n/a
|
You're redirecting the output so you're going to have to read from the
output stream or the process will hang once it fills (I don't remember offhand how many bytes it can buffer). If you're doing this in .net 1 you're going to have to poll the stream from another thread, in 2.0 you can use BeginOutputReadLine instead. wfairl@gmail.com |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to open Web Application pages (ASPX) in Windows application. | arameshmca | Software | 1 | 02-07-2008 03:18 AM |
| I AM THRU WITH DVDPLANET!!!!!!! | J. Alfred Prufrock | DVD Video | 21 | 10-13-2003 11:56 PM |