开发者

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

开发者 https://www.devze.com 2022-12-20 21:30 出处:网络
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 Wi

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

精彩评论

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