检索 Windows 服务的正常运行时间?
有没有办法通过 C# 代码获取 Windows 服务的启动时间? 有没有办法获取过去72小时内Windows服务重新启动的次数?
Is there is a way to get the start time of a windows service by code in C#?
Is there is a way to get the number of re-starts of the windows service in last 72 hours?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是第一个问题。
至于第二个问题,我认为你需要查看 Windows 事件来查找它启动了多少次,除非你可以更改代码以将其记录在某处。
This for the first question.
As for the second question, I think you would need to look at the Windows events to find how many time it started, unless you can change the code to log it somewhere.
您可以尝试从事件日志中捕获它。据我所知,当服务启动时,它会将一个条目挂接到事件日志中。
You can try to capture it from the Event Log. As far as I know when a service starts it hooks an entry to the event log.