获取应用程序池的正常运行时间

JPe*_*ero 7 c# iis-7 application-pool

有没有办法可以确定c#中的应用程序池(在IIS7中)已启动多长时间(自启动以来的时间,或上次重启)?

Eri*_*rey 8

DateTime.Now - Process.GetCurrentProcess().StartTime
Run Code Online (Sandbox Code Playgroud)

Process.GetCurrentProcessInfo() 不存在.


Jos*_*hua 5

真的很愚蠢的伎俩:在一些所有人都使用的类中,使用类构造函数来记住你的开始时间并使用aspx页面来接收它.现在比较当前时间.