English 中文(简体)
视窗服务 恢复工作不重启
原标题:Windows Services Recovery not restarting service

我将视窗服务的恢复召集在一起,以便在故障发生后一分钟的延误重新启用。 但是,我从未听说过它实际上重新开始服役(即使是最明显的错误)。

我在《意见》中确实收到以下信息:

来源(MyApp.exe)中的事件说明(1)无法找到。 当地计算机可能没有必要的登记信息或电离层电离层电离辐射文件,无法显示远程计算机的信息。 您可以使用“AUXSOURCE”旗帜来检索这一描述;详见“帮助和支持”。 The following information is part of the activity: Access violations at address 00429874 in model MyApp.exe . 地址 00456704。

是否有其他事情要做? 我的法典(我使用德尔菲语)中是否有需要加以规定才能做到这一点?

最佳回答

服务恢复意在处理服务失事的情况,因此,如果你去找工作,在你的服务过程中正确点击“端”程序,恢复逻辑就应当ick。 我不认为,如果你的工作顺利结束,服务恢复逻辑就会出现问题(即使它有过错)。

另外,活动信息还表明,您的申请书称“Event 2008/6,具体说明活动1。 但是,你没有向活动观察者登记你的活动信息,以便把活动信息1转化为有意义的案文。

问题回答

Service Recovery only works for unexpected exit like (exit(-1)) call. For all the way we use to stop the service in usual way will not works for recovery. If you want to stop service and still wants recovery to work, call exit(-1) and you will see error message as "service stopped with unexpected error" , and then your service will restart as recovery setting is.

如果您提前确定,由海事委员会重新启用,服务管制管理员将努力重新开始服务。 详见:,载于SERVICE_FAILURE_ACTIONS的文件中。

A service is considered failed when it terminates without reporting a status of SERVICE_STOPPED to the service controller.

可通过制定<条码>SERVICE_FAILURE_ACTIONS_FLAG加以调整。 。 你们可以通过检查“以错误为阻止”的“可行行动”对回收表格的检查箱,从服务手册中确定这一背景。

If this member is TRUE and the service has configured failure actions, the failure actions are queued if the service process terminates without reporting a status of SERVICE_STOPPED or if it enters the SERVICE_STOPPED state but the dwWin32ExitCode member of the SERVICE_STATUS structure is not ERROR_SUCCESS (0). If this member is FALSE and the service has configured failure actions, the failure actions are queued only if the service terminates without reporting a status of SERVICE_STOPPED.

因此,根据你如何安排你的工作,你如何组合你的失败行动,如果你有致命错误,则只需打上<代码>ExitProcess(或>,并退还非零值。 然而,确保你的工作没有处理SCM的守则,即你的工作达到<条码>的SSERVICE_STOPPED。 这确保了你未能采取行动......

If you kill service from task manager - forgot for recovery logic. In background task manager kills process by stop service . and as yuo can guess - this is not service failure. This forced me to kill it really with Visual Studio. In task manager right click on service process. Select debug. In Visual studio select Debug-> Terminate All. And now you have simulated service fail. In this case recovery logic works fine.





相关问题
Why running a service as Local System is bad on windows?

I am trying to find out the difference between difference service account types. I tumbled upon this question. The answer was because it has powerful access to local resources, and Network Service ...

Programmatically detect Windows cluster configuration?

Does anyone know how to programatically detect that a Windows server is part of a cluster? Further, is it possible to detect that the server is the active or passive node? [Edit] And detect it from ...

get file icon for Outlook appointment (.msg)

I ve read Get File Icon used by Shell and the other similar posts - and already use SHFileInfo to get the associated icon for any given extension, and that works great. However, Outlook uses ".msg" ...

Identifying idle state on a windows machine

I know about the GetLastInputInfo method but that would only give me the duration since last user input - keyboard or mouse. If a user input was last received 10 minutes ago, that wouldn t mean the ...

Terminating a thread gracefully not using TerminateThread()

My application creates a thread and that runs in the background all the time. I can only terminate the thread manually, not from within the thread callback function. At the moment I am using ...

热门标签