Windows服务恢复/重新启动 [英] Windows Service recovery/restarting

查看:114
本文介绍了Windows服务恢复/重新启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个服务框架来简化我们服务的开发,并通过采用可靠的设计模式帮助使它们更加统一。


我有一个问题不是通过搜索网络很容易得到答案,服务是否可以判断它是否正常"正常"开始。或者作为恢复重启的结果。


如果应用程序日志可能有一条消息,例如"由于先前故障后恢复而导致服务重新启动",那将会很有帮助。或者其他什么,我们可以记录,如果我们可以判断开始是重启。


Thx



解决方案


你能做的最好的就是windows的恢复属性失败时的服务运行一个程序,该程序记录有关正在重新启动的服务的消息,并使用服务控制器手动重新启动服务。


  https://docs.microsoft.com/en-us/dotnet/framework/windows-services/how-to-start-services


I 'm developing a service framework to simplify the development of our services and help make them more uniform by adopting a solid design pattern.

A question I have that's not easy to get an answer to by searching web, is whether a service can tell if its being started "normally" or as the result of a recovery restart.

It would be helpful if the Application log could have a message like "Service restarting due to recovery after prior failure" or something, we could log that IF we could tell that the start was a restart.

Thx

解决方案

The best you could do is on the recovery properties of the windows service on failure is run a program that logs a message about service the is restating and restart the service manually using a service controller.

 https://docs.microsoft.com/en-us/dotnet/framework/windows-services/how-to-start-services


这篇关于Windows服务恢复/重新启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆