如何在 ASP.NET 中监听 IIS 关闭事件 [英] How to listen to IIS shutdown event in ASP.NET
本文介绍了如何在 ASP.NET 中监听 IIS 关闭事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的 ASP.NET 静态变量中有每次 X 插入将自身刷新到 DB 中.问题是,如果我发布应用程序,IIS 进程会被我所有的静态材料杀死.
I have in my ASP.NET static variable that flushes itself to DB every X insertions. Problem is, if I publish the application , the IIS process is killed with all my static material.
如何保留它 - 或者在 ASP.NET 应用程序关闭后如何刷新它?
How can I preserve it - or how can I flush it once ASP.NET application is shutting down?
谢谢
推荐答案
Global.asax
Global.asax
void Application_End(object sender, EventArgs e)
{
// SHUTDOWN CODE HERE
}
这篇关于如何在 ASP.NET 中监听 IIS 关闭事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文