1
次のコードは、通常のコンソールアプリケーションに大きな働いている:なぜProcess.OutputDataReceivedがASP.NETで動作しないのですか?どうすれば修正できますか?
private void button1_Click(object sender, EventArgs e)
{
Process process = new Process();
process.StartInfo.FileName = @"a.exe";
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.UseShellExecute = false;
process.OutputDataReceived += new DataReceivedEventHandler(process_OutputDataReceived);
process.Start();
process.BeginOutputReadLine();
}
void process_OutputDataReceived(object sender, DataReceivedEventArgs e)
{
this.Invoke(new Action(delegate() { textBox2.Text += "\r\n" + e.Data; }));
}
しかし、Webアプリケーションでは、テキストボックスに「A.EXE」を開始しますが、dosen't出力。どうすれば修正できますか?ありがとう。