【发布时间】:2012-04-23 12:51:39
【问题描述】:
应用程序在尝试调用“StandardOutput.ReadLine()”时挂起。
代码:
ProcessStartInfo startInfo = new ProcessStartInfo("c:\\windows\\system32\\myTesting.exe");
String s = " ";
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.CreateNoWindow = true;
startInfo.RedirectStandardInput = true;
startInfo.RedirectStandardOutput = true;
startInfo.UseShellExecute = false;
Process p = Process.Start(startInfo);
p.StandardInput.WriteLine("list volume\n");
String f = "";
while (!p.StandardOutput.EndOfStream)
{
s = p.StandardOutput.ReadLine();
}
“死锁异常”——错误有时会发生,但并非总是如此。
【问题讨论】:
标签: c# asp.net multithreading c#-4.0 process