在 IIS 中重新启动应用程序池时立即运行 Application_Start [英] Run Application_Start immediately when application pool restarts in IIS

查看:27
本文介绍了在 IIS 中重新启动应用程序池时立即运行 Application_Start的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在应用程序的 application_start 阶段做一些缓存操作.因此,当应用程序池重新启动时,所有缓存都将消失.是否可以在应用程序池重启时触发 application_start 或者您有更好的想法来解决这个问题?

We are doing some caching operations in the application_start phase in the application. So all the cache is going away when the application pool restarts. Is it possible to trigger application_start when the application pool restarts or do you have better ideas to solve this problem ?

推荐答案

您可以使用 应用程序初始化IIS 7.5,它借用了 IIS8 的功能,或者如果您使用的是 ASP.NET 4.0 + 则有 应用程序自动启动.

You could use Application Initialization for IIS 7.5, it borrows functionality from IIS8, or if you are using ASP.NET 4.0 + there is application auto start.

对于 ASP.NET 2.0 i 3.5 有一个 IMO 有点骇人听闻的解决方案,您可以在事件日志中记录应用程序池回收,然后在事件日志中设置将在该事件上执行的任务,这里是 详情

For ASP.NET 2.0 i 3.5 there is a IMO somewhat hackish solution, you can log application pool recycle in Event log and then in event log set a task that will be performed on that event, here are the details

这篇关于在 IIS 中重新启动应用程序池时立即运行 Application_Start的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆