Run Application_Start immediately when application pool restarts in IIS(在 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 IIS 中重新启动应用程序池时立即运行 Application_Start


基础教程推荐
- 全局 ASAX - 获取服务器名称 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01