c# - How to make window service to restart on error -
i having msmq on windows 2008. messages available in private queue. have 1 wcf subscriber (written in c#) installed windows service. problem wcf subscriber stops picking messages queue. if restart service again works fine. attached ierror
handler log reason , exception.
now handle issue wanted is, set recovery property restart service on first failure , problem how throw error handleerror()
method of ierrorhandler class
?
please tell me best way throw exception in window service can restarted.
while better address underlying cause of exceptions, valid in scenarios implement fail fast methodology. indeed, ability kill processes have become "flawed" in manner critical concept of fault tolerance.
so, make windows service commit suicide:
void killself() { try { // code close open connections/dispose // of unmanaged resources etc ... } { environment.exit(1); } }
service recovery options should set restart automatically. ensure service comes straight again.
Comments
Post a Comment