确定应用程序池上次回收的时间

发布于 2024-08-25 18:22:20 字数 101 浏览 2 评论 0原文

我正在编写一个监视应用程序池的.NET 服务。根据特定的触发器我正在重新启动它们。 但是,如果触发器发生在它们最后一次回收之前,我不想重新启动它们。如何知道应用程序池的“最后回收时间”?

I'm writing a .NET service that monitors application pools. based on specific triggers I'm restarting them.
However, I do not want to restart them if the trigger occurred before they were recycled for the last time. How can I know the "last recycle time" of an app pool?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

喵星人汪星人 2024-09-01 18:22:20

If the LogEventOnRecycle property is set, you should be able to read this information from the event log using the EventLog Class

诺曦 2024-09-01 18:22:20

我深入查看了事件日志,并且能够检测到应用程序池上次回收的时间,但它非常占用 CPU 资源,因为您必须从磁盘读取日志。我强烈建议使用

Process.GetCurrentProcess().StartTime

I went down the rabbit hole of looking through the event log and I was able to detect last when an app pool was last recycled but it was very cpu intensive because you have to read logs from the disk. I would highly suggest using

Process.GetCurrentProcess().StartTime
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文