asp.net - How to prevent a service from stopping on Error -


i wrote windows service polls data on timeintervalls , writes them in database. if there occures error writing database , service stops. want robust solution goes on if error occures.

i put try/catch bocks around every action done service in onstart, onstop , dispose sopped anyway.

is try/catch correct approach? , have put it? put try/catch in main method?

many thanks.

try wrapping call in transactionscope, roll failed changes trying make , should not break on failure.

using (var scope = new transactionscope())    {       deletestuff();       updatestuff();       scope.complete();    } 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -