In ASP.NET:
-
How can I tell when the ASP.NET worker process last restarted?
-
In ASP.NET, how can I tell when the app domain last recycled?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For the worker process, you can programmatically read Process -> Elapsed Time from the corresponding perf. counter (1) or directly from the System.Diagnostics.Process namespace; for the AppDomain, you can set an application-level variable at start-up to serve as your baseline and measure against that manually.
Scott Mitchell actually has a couple of good posts on this that are still relevant 8 years later, believe it or not (2). Running on Cassini (Vista, VS 2008), I’m seeing an accurate system up-time with:
…and accurate Process/AppDomain up-times with these:
I’m also able to obtain the correct PerfomanceCounter, but can’t seem to read the correct value (always zero, under my setup):
Scott’s articles are definitely worth a read – there’s a wealth of info in ProcessInfo and ProcessModelInfo (eg. ProcessModelInfo.GetHistory), but unfortunately it’s not available on Cassini:
UPDATE:
great explanation of how to read the counter correctly to avoid the zero on NextValue(): Link
HTH
(1) https://serverfault.com/questions/90927/lifetime-of-iis-worker-process-or-appdomai
(2) https://web.archive.org/web/20211020113638/https://www.4guysfromrolla.com/articles/041002-1.aspx