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#?
+1
A:
From the ASP.NET application, you can try TimeSpan uptime = (DateTime.Now - ProcessInfo.GetCurrentProcessInfo ().StartTime)
Gonzalo
2009-11-23 16:07:29
A:
If you mashed http://stackoverflow.com/questions/249927/application-pool-from-c and http://forums.iis.net/t/1162615.aspx, you should get it
Ruben Bartelink
2009-11-23 16:11:36
+1
A:
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.
Joshua
2009-11-23 16:21:46
By class constructor do you mean `static` constructor? Because the static constructor is what you'd want to do with this, I've never considered how easily you could use a static constructor to achieve something like this before though.
Chris Marisic
2010-05-27 20:59:49
Yeah class constructor in IL = static constructor in C#.
Joshua
2010-05-27 23:42:04
A:
DateTime.Now - Process.GetCurrentProcess().StartTime
Process.GetCurrentProcessInfo() doesn't exist.
Eric Humphrey
2010-09-09 22:40:48