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
基础教程推荐
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- WPF 模态进度窗口 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
