本文介绍了如何使Windows服务正常失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望多年来第一次构建Windows服务,并且稍微失去了一点点。我想配置服务,所以它基本上总是在失败时重新启动。这是非常无害的,无数的网络服务电话意味着许多失败点。 我如何例如如果出现未处理的异常,或者没有回头的处理过的异常,请向Windows发出我的服务失败的信号?
解决方案一个启用恢复和自动启动配置的ServiceInstaller扩展 [ ^ ]
正如评论中所讨论的那样,你当然不希望你的服务失败,但它会像常规exe一样失败:当你没有捕获异常或者系统真的以某种方式爆炸时。重新启动选项在服务属性中配置。
I am looking to build a Windows service for the first time in ages, and have lost touch a bit. I want to configure the service so it basically always restarts on failure. It's quite innocuous, and umpteen web service calls mean many points of failure. How do I e.g. in the event of an unhandled exception, or a handled one from which there is no turning back, signal to Windows that my service has failed?
解决方案 A ServiceInstaller Extension That Enables Recovery and Autostart Configuration[^]As discussed in the comments, you certainly don't want your service to fail but it will fail just like a regular exe will: when you don't catch an exception or if the system really blows up somehow. The restart options are configured in the Services properties.更多推荐
如何使Windows服务正常失败?
发布评论