开发者

Window Service is not able to restart even though Recovery option is configured

In my Window Service if Service is enable to connect to SQL Server it throws an exception and windows service will not start. To overcome 开发者_JAVA技巧this situation I have set recovery option of Windows Service to First Failure, Second Failure to Restart the Service, Reset fail count after 1 day and Restart Service to 0 minutes.

What I want is when service throws an exception(unhandled) service should go for recovery option which I have configured and should try to restart the service. But this doesnt work.

After configuring service for recovery option if I got to the Task Manager and manually end the process then only this recovery option gets applied.

Can anyone help me on this?


If we call Environment.Exit( -1 ) it send signal to SCM that service is crashed and Recovery option will get respect.

Hope this will help others like me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜