OnShutdown Event in Service 
Author Message
 OnShutdown Event in Service

This is a problem that makes me feel stupid.

I have a line in the OnShutdown() event in a service that just writes to the
EventLog. However, nothing gets written when the system shutsdown. All the
other events work. I have set the CanShutdown property but still no joy.

Any help would save my bacon.

Alex.



Sun, 22 May 2005 20:10:46 GMT  
 OnShutdown Event in Service
Alex,

    Is it possible that an exception is being thrown and you don't know it?
I would try some old-school debugging here, writing to a text file in
increments, checking to see if there is an error in your code (you would
check the file after your service stops).

    Hope this helps.

--
               - Nicholas Paldino [.NET/C# MVP]


Quote:
> This is a problem that makes me feel stupid.

> I have a line in the OnShutdown() event in a service that just writes to
the
> EventLog. However, nothing gets written when the system shutsdown. All the
> other events work. I have set the CanShutdown property but still no joy.

> Any help would save my bacon.

> Alex.



Sun, 22 May 2005 21:11:50 GMT  
 OnShutdown Event in Service
I tried it writing to a text file. Again, all the other events work, except
for the OnShutdown. I am not convinced that the event is firing at all.

Alex



Quote:
> Alex,

>     Is it possible that an exception is being thrown and you don't know
it?
> I would try some old-school debugging here, writing to a text file in
> increments, checking to see if there is an error in your code (you would
> check the file after your service stops).

>     Hope this helps.

> --
>                - Nicholas Paldino [.NET/C# MVP]



> > This is a problem that makes me feel stupid.

> > I have a line in the OnShutdown() event in a service that just writes to
> the
> > EventLog. However, nothing gets written when the system shutsdown. All
the
> > other events work. I have set the CanShutdown property but still no joy.

> > Any help would save my bacon.

> > Alex.



Sun, 22 May 2005 23:08:05 GMT  
 OnShutdown Event in Service
I'd go with Nicholas here.

Have a go catching specifically for an InvalidOperationException
within the OnShutdown event. I have seen this raised when a Service
attempts to write to the Event Log and the Event Log listener service
has already collapsed.

Al

Quote:

> I tried it writing to a text file. Again, all the other events work, except
> for the OnShutdown. I am not convinced that the event is firing at all.

> Alex



> > Alex,

> >     Is it possible that an exception is being thrown and you don't know
>  it?
> > I would try some old-school debugging here, writing to a text file in
> > increments, checking to see if there is an error in your code (you would
> > check the file after your service stops).

> >     Hope this helps.

> > --
> >                - Nicholas Paldino [.NET/C# MVP]



> > > This is a problem that makes me feel stupid.

> > > I have a line in the OnShutdown() event in a service that just writes to
>  the
> > > EventLog. However, nothing gets written when the system shutsdown. All
>  the
> > > other events work. I have set the CanShutdown property but still no joy.

> > > Any help would save my bacon.

> > > Alex.



Mon, 23 May 2005 04:37:01 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. ATL Service - Sporadically does not report SERVICE STOP in event log

2. Web Service writing Event Log entries?

3. Windows Service and Timer Event

4. Window Service Event Handling

5. Service Event Trap

6. event callback using XML Web Service

7. Cross process events from singleton service

8. Receiving events in a NT service...

9. COM+ Event Service on NT4

10. Service NT and its events

11. Event logging added to a service application

12. NT Service and Event Viewer messages

 

 
Powered by phpBB® Forum Software