Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have an ASP.NET app hosted in IIS, and I have automatic worker process recycling/shutdown disabled. I'd like to have a rough idea of how long the app has been running continuously without being re-loaded.

My thinking is that one source from which this can be gleaned is information about when the worker process was last recycled, perhaps in IIS logs or performance counters. Or alternatively, from information about when the AppDomain itself was created, perhaps in performance counters. Either way, I can't find any such information. Short of changing the code, is it possible to determine this for an already-deployed app?

Perhaps 3rd party tools that monitor processes? Or information from IIS in the event log?

Originally posted on SO: http://stackoverflow.com/questions/1835469/lifetime-of-worker-process-or-appdomain

share|improve this question

2 Answers 2

up vote 1 down vote accepted

I'm not aware of any counter information for the AppDomain, but in perfmon, you can get the Process -> Elapsed Time which shows how long the app pool has been running.

share|improve this answer
    
Awesome! Is there any way to find out the PID of the process associated with each counter instance? –  G-Wiz Dec 4 '09 at 20:08
    
Ah it looks like the AppDomain is reloaded independently of the process recycling (e.g. in event of web.config change). Very useful answer nonetheless. –  G-Wiz Dec 4 '09 at 20:23
    
Yes, the AppDomain and App Pool often do have different lifecycles. It is possible to capture when an AppDomain recycles and log it, but I don't know if it's possible to get the info from any ASP.NET counters after the fact. To get the PID, there is another process counter that is the process identifier. Or, you can do this: weblogs.asp.net/owscott/archive/2007/03/19/… –  Scott Forsyth - MVP Dec 4 '09 at 22:49
    
Oh man, so awesome, thanks a ton! –  G-Wiz Dec 4 '09 at 22:54

I know you said you don't want to change any code, but if that is an option, you could just log the start time and process ID in the Application_Start event of your asp.net application. Then you have both the running time of your application and the app pool as a new PID means a recycled App pool.

share|improve this answer
    
Yeah, I've already instituted this but cannot yet deploy it. –  G-Wiz Dec 5 '09 at 11:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.