Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Application Pool Uptime in c#

Is there a way I can determine how long an application pool (in IIS7) has been up (time since started, or last restart) in c#?

like image 272
JPero Avatar asked Nov 23 '09 16:11

JPero


People also ask

How do I find out when app pool was last recycled?

Now to view any Application Pool recycle events, simply open the Event Viewer and click on the standard System event log.

How do I view IIS application pool logs?

To change it using GUI: II S Manager | Application Pools | Select App Pool -> Advanced Settings | Generate Recycle Event Log Entry. Save this answer. Show activity on this post. Go to Logging and ensure either ETW event only or Both log file and ETW event ...is selected.

How long does app pool recycle take?

Seems its usual thing it takes some time to start with new process. But our case it takes around 15-20 mins to getting the palliation up or recycle process to complete.

Where is IIS recycle log?

To enable it using the IIS Manager go to: Application Pools > Select Application Pool > Advanced Settings and you should find: Generate Recycle Event Log Entry.


2 Answers

DateTime.Now - Process.GetCurrentProcess().StartTime

Process.GetCurrentProcessInfo() doesn't exist.

like image 67
Eric Humphrey Avatar answered Nov 10 '22 10:11

Eric Humphrey


Really stupid trick: in some class that everything uses, use a class constructor to remember your start time and use an aspx page to receive it. Now compare to current time.

like image 23
Joshua Avatar answered Nov 10 '22 10:11

Joshua