C# 如何在ASP.NET中读取控制台输出?
我想从控制台(cmd)读取数据,我尝试了以下代码C# 如何在ASP.NET中读取控制台输出?,c#,asp.net,console,stdout,C#,Asp.net,Console,Stdout,我想从控制台(cmd)读取数据,我尝试了以下代码 compiler.StartInfo.RedirectStandardOutput = true; compiler.Start(); compiler.StandardOutput.ReadToEnd(); 但它不起作用试试这个 Process compiler = new Process(); compiler.StartInfo.FileName = "SOME.exe"; compiler.StartInfo.Arguments = "
compiler.StartInfo.RedirectStandardOutput = true;
compiler.Start();
compiler.StandardOutput.ReadToEnd();
但它不起作用试试这个
Process compiler = new Process();
compiler.StartInfo.FileName = "SOME.exe";
compiler.StartInfo.Arguments = "SOME ARG";
compiler.StartInfo.UseShellExecute = false;
compiler.StartInfo.RedirectStandardOutput = true;
compiler.Start();
var result=compiler.StandardOutput.ReadToEnd();
compiler.WaitForExit();
定义不工作。这可能会挂起。使用