.net - In windows service, how to get the service start time and service end time? -


How to get the service start time and service end time in the window service?

You can use the System.Diagnostics.Process class. In particular, startup and outtime properties

  // System.Diagnostics.Process p = System.Diagnostics.Process.GetCurrentProcess (); System.Diagnostics.Process p = System.Diagnostics.Process.GetProcessById (6684); Console.WriteLine (p.StartTime); // ... console.print line (p. Extratime);   

Note that you can call ExitTime only on the process that is complete, and before you exit it, you need to process it.



Comments