リモート サーバー上にある .exe を実行していますが、PsExec がハングしたように見え、ローカル サービスが終了しません。.exe はサーバー上で正常に実行されますが、終了したらローカル サービスを終了します。
これは私が持っているコードです:
Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.FileName = @"C:\Program Files (x86)\PSTools\PsExec.exe";
p.StartInfo.Arguments = @"\\<remote .exe path>";
p.Start();
//I have tried the following to exit the local service when a response is
//received but it still hangs.
//string output = p.StandardOutput.ReadToEnd();
//string errormessage = p.StandardError.ReadToEnd();
//p.WaitForExit();
リモート サービスが終了したときにローカル サービスを終了するにはどうすればよいですか?