The .NET Windows service terminated unexpectedly

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi ,

I have a windows service I developed in c# .NETAfter every 2 days I get the
following error in my eventlog
"The Ibac service terminated unexpectedly. It has done this 1 time(s). The
following corrective action will be taken in 0 milliseconds: No action."
I am not able to capture the error to know why would the service terminate.
Can anyone tell me why would the service show such a behaviour and how do I
catch it and solve it.

Thanks.
 
MVB said:
I have a windows service I developed in c# .NETAfter every 2 days I
get the following error in my eventlog
"The Ibac service terminated unexpectedly. It has done this 1
time(s). The following corrective action will be taken in 0
milliseconds: No action."
I am not able to capture the error to know why would the service
terminate. Can anyone tell me why would the service show such a
behaviour and how do I catch it and solve it.

Hi MVB. This message tells you that your service exited abnormally (meaning,
not in response to a stop command). Although managed applications normally
do not crash, it may have done this in response to an unhandled exception.
Try adding an exception handler around the contents of every service control
entry point method (like OnStart(), OnStop()) and also around the entry
point method of any new threads that you create. Then, use the
System.Diagnostics.EventLog class to log the error message and stack trace
(see System.Exception's methods to see how to get this information). Also
log if you intentionally exit the service. Later, following the failure, you
can use the Event Viewer tool (eventvwr.exe) to observe these messages and
see why your service exited. An alternative approach is to attach the Visual
Studio debugger to the running service after it starts and wait for it to
detect an unhandled exception and break automatically. I hope this helps.
 
Back
Top