G
Guest
Hi there
I've written a windows service that works OK, apart fom the fact that if it were to fail during startup, I'm not sure of the best way to handle it. If I let the exception fall thru' from my OnStart() method, the exception is reported in the event log and the service is not marked as started. But the exception message is messy and I want to catch it and report it cleanly if I can. If I catch it myself, report it then continue (without re-throwing), the service is marked as started, which isn't what I want.
Is there any way I can catch the exception for reporting myself, then indicate to the SCM that it hasn't started, without relying on 'fall through' exceptions to inidictate this?
Thanks
Jon
I've written a windows service that works OK, apart fom the fact that if it were to fail during startup, I'm not sure of the best way to handle it. If I let the exception fall thru' from my OnStart() method, the exception is reported in the event log and the service is not marked as started. But the exception message is messy and I want to catch it and report it cleanly if I can. If I catch it myself, report it then continue (without re-throwing), the service is marked as started, which isn't what I want.
Is there any way I can catch the exception for reporting myself, then indicate to the SCM that it hasn't started, without relying on 'fall through' exceptions to inidictate this?
Thanks
Jon