停止调试的执行方法 [英] Executing method on stop debugging
问题描述
我正在寻找一种在ASP.NET Web应用程序中停止调试的方法.
I'm looking for a way to execute a method on stop debugging in an ASP.NET web application.
我有几种必须以应用程序关闭方式执行的资源释放方法.(包括停止调试(杀死))
I have several resource releases methods that I have to execute in any way the application shuts down. (Including stop debugging (kill))
我尝试了 Application_End
并在global.asax中覆盖了 Dispose()
,但是它们在停止调试时未执行. AppDomain.CurrentDomain.ProcessExit
事件.
I've tried Application_End
and overriding Dispose()
in global.asax but they are not executing on stop debugging. Either AppDomain.CurrentDomain.ProcessExit
event.
实际上,当我们终止进程时,任何方法都无法执行是有道理的,但这可能是一种创造性的方法.
Actually it makes sense any method can not be executed while we kill the process but it might be a creative way to do so.
推荐答案
您无法处理与终止过程相同的终止过程.
You can't handle termination of the process from the same process which you are terminating.
要在停止调试时执行任何任务,您将需要另一种方法来观察进程并在第一个进程终止时执行所需的功能.
To perform any tasks on stop debugging you will need another method which observes the process and executes required functions when the first process terminates.
这篇关于停止调试的执行方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!