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
基础教程推荐
- C# 9 新特性——record的相关总结 2023-04-03
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- 获取C#保存对话框的文件路径 2022-01-01
- 将数据集转换为列表 2022-01-01
- 如果条件可以为空 2022-01-01
