我已经做了哪些努力:
已经使用下面的方法,但是都不起作用。
Process.GetCurrentProcess().Exited += Program_Exited; AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit); if (AppDomain.CurrentDomain.IsDefaultAppDomain()) AppDomain.CurrentDomain.ProcessExit += MyTerminationHandler; else AppDomain.CurrentDomain.DomainUnload += MyTerminationHandler; AppDomain.CurrentDomain.DomainUnload += (object sender, EventArgs e) => { Process.Start("cmd.exe"); throw new Exception("45456"); log4net.LogManager.GetLogger("FormatFileName").Debug("应用程序域卸载"); };修改
--- 回复: ---
在退出前会有一些事件的,比如应用程序域卸载事件