一、小工具的用处:
1.可以保证应用程序始终处于运行状态,确保其提供服务的稳定性和可靠性
2.在发生异常或崩溃时,可以自动重启应用程序,避免因程序崩溃而导致业务中断
3.实现无人化程序的自动运行
二、如果要模拟程序崩溃可以用这句代码
Environment.FailFast("程序意外终止");
using System.Collections.Generic; using System.Threading; static void Main(string[] args) { var monitorThread = new Thread(MonitorApplication); monitorThread.Start(); Console.WriteLine("程序已启动..."); // 启动目标应用程序 注:以下是我的测试路径 请替换为你的应用程序的路径 var targetProcessPath = @"C:\Users\34349\Desktop\Storage\Storage\