C# asp.net Web ページを使用して、サーバーで .ps1 PowerShell ファイルを実行しようとしています。このスクリプトは 1 つのパラメーターを取り、サーバー上のコマンド プロンプトを使用して動作することを確認しました。実行後、Web ページに結果を表示する必要があります。
現在、私は使用しています:
protected void btnClickCmdLine(object sender, EventArgs e)
{
    lblResults.Text = "Please wait...";
    try
    {
        string tempGETCMD = null;
        Process CMDprocess = new Process();
        System.Diagnostics.ProcessStartInfo StartInfo = new System.Diagnostics.ProcessStartInfo();
        StartInfo.FileName = "cmd"; //starts cmd window
        StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
        StartInfo.CreateNoWindow = true;
        StartInfo.RedirectStandardInput = true;
        StartInfo.RedirectStandardOutput = true;
        StartInfo.UseShellExecute = false; //required to redirect
        CMDprocess.StartInfo = StartInfo;
        CMDprocess.Start();
        lblResults.Text = "Starting....";
        System.IO.StreamReader SR = CMDprocess.StandardOutput;
        System.IO.StreamWriter SW = CMDprocess.StandardInput;
        SW.WriteLine("@echo on");
        SW.WriteLine("cd C:\\Tools\\PowerShell\\");
       SW.WriteLine("powershell .\\poweron.ps1 **parameter**");
        SW.WriteLine("exit"); //exits command prompt window
        tempGETCMD = SR.ReadToEnd(); //returns results of the command window
        lblResults.Text = tempGETCMD;
        SW.Close();
        SR.Close();
    }
    catch (Exception ex)
    {
        lblErrorMEssage.Text = ex.ToString();
        showError();
    }
}
ただし、powershell を呼び出す行を含めると、最初の「お待ちください..」も表示されません。ScriptManager で AsyncPostBackTimeout を増やしたとしても、最終的にはタイムアウトになります。誰が私が間違っているのか教えてもらえますか? ありがとう