我需要从我的Web应用程序启动外部进程。 这意味着使用System.Diagnostics.ProcessStartInfo来调用并执行控制台应用程序(exe)。 但是,我需要以某种方式确保在执行期间没有出错 , 并知道应用程序何时完成其工作。
什么是捕获所有可能的错误并找出它何时完成的最佳方法?
I need to start an external process from my web application. This means using System.Diagnostics.ProcessStartInfo to call out and execute a console app (exe). But I then need to somehow make sure nothing went wrong during it's execution and know when the application completed its work.
What's the best way to both catch all possible errors and find out when it's completed?
最满意答案
我当然希望你能控制外部应用程序的代码,否则你会遇到很多麻烦。 最重要的是要确保该应用程序无法挂起而不能终止。
然后,您可以使用WaitForExit(),ExitCode,StandarError,StandardOut来“捕获所有可能的错误并找出它何时完成”
I sure hope you have control of the code for the external application or you are in for a lot of headaches. The MOST important thing to do is make sure there is no way for that application to hang and not terminate.
You can then use the WaitForExit(), ExitCode, StandardError, StandardOut to "catch all possible errors and find out when it's completed"
更多推荐
发布评论