开发者

Determine the last time an Application Pool recycled

开发者 https://www.devze.com 2022-12-23 13:52 出处:网络
I\'m writing a .NET service that mo开发者_运维知识库nitors application pools. based on specific triggers I\'m restarting them.

I'm writing a .NET service that mo开发者_运维知识库nitors 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?


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


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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号