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


- MoreLinq maxBy vs LINQ max + where 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- 输入按键事件处理程序 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01