PC Review


Reply
Thread Tools Rate Thread

C# Windows Service problem - installer possibly? Some services stop automatically...

 
 
kevin89065@gmail.com
Guest
Posts: n/a
 
      25th Oct 2005
I have a windows service that I am trying to get working using C# and
WinXP through the .NET framework. I had got the service to run this
morning, however while it was running I realized that I wanted to
change some code and it tried to stop it. It attempted to stop itself
but gave me an error saying that it wasn't able to stop because it had
timed out. Then the service's status in the Computer Management ->
Service and Applications -> Services window was "stopping". It never
changed from this and I restarted my computer and then uninstalled the
service and made my changes to the code, recompiled and reinstalled the
service.

Then from that point on whenever I try to run the service it tells me
that it started and stopped, and some services stop automatically if
there is no work to be done. This is not the case, so there is an error
somewhere else. I have looked in the event viewer and there are no
events that have taken place with this project since it ran the time it
wouldn't allow itself to be stopped(there are no errors in the viewer
from that however), including any event from an MSI installer. This
leads me to believe that possibly something is wrong with that? When I
install the service, it doesn't give me an error and it says that it
installs successfully and it's there in the Services window to give me
the "some services stop automatically" message when I try to start it,
but the installation never gets added to the event log.

Does anyone have any ideas what I can do?

 
Reply With Quote
 
 
 
 
kevin89065@gmail.com
Guest
Posts: n/a
 
      25th Oct 2005
It turns out the problem was an event log that was full. While
debugging it had entered a loop that it wasn't getting out of and I put
a "Write to event log" action there, and when it finally got through,
it had a ton of events to add to the log, which filled up which
explains why there were no events since the event earlier in the
morning. Once I cleared the event log and took out the statement that
wrote the message in the loop it is fine.

 
Reply With Quote
 
Brian Gideon
Guest
Posts: n/a
 
      25th Oct 2005
Kevin,

That's a particularly nasty problem with services that write to the
event log. When the log is full there the write will fail and generate
an exception as expected. A lot of people usually put a try-catch
block that will catch all exceptions in a last resort attempt at
keeping the service running. If that exception information is then
written to the event log...Catch-22.

Brian

(E-Mail Removed) wrote:
> It turns out the problem was an event log that was full. While
> debugging it had entered a loop that it wasn't getting out of and I put
> a "Write to event log" action there, and when it finally got through,
> it had a ton of events to add to the log, which filled up which
> explains why there were no events since the event earlier in the
> morning. Once I cleared the event log and took out the statement that
> wrote the message in the loop it is fine.


 
Reply With Quote
 
Nick
Guest
Posts: n/a
 
      2nd Nov 2005
Event logging, while important, isn't often 'critically necessary'...

Wrap your event logging in a try with an empty catch block and allow it to
fail until the cows (or the administrators) come home.


Nick F


"Brian Gideon" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Kevin,
>
> That's a particularly nasty problem with services that write to the
> event log. When the log is full there the write will fail and generate
> an exception as expected. A lot of people usually put a try-catch
> block that will catch all exceptions in a last resort attempt at
> keeping the service running. If that exception information is then
> written to the event log...Catch-22.
>
> Brian
>
> (E-Mail Removed) wrote:
>> It turns out the problem was an event log that was full. While
>> debugging it had entered a loop that it wasn't getting out of and I put
>> a "Write to event log" action there, and when it finally got through,
>> it had a ton of events to add to the log, which filled up which
>> explains why there were no events since the event earlier in the
>> morning. Once I cleared the event log and took out the statement that
>> wrote the message in the loop it is fine.

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What services are needed for Windows Installer Service? telicalbook Windows XP General 1 29th Nov 2005 04:50 AM
Windows XP services stop automatically Jaco Swart Windows XP Help 1 30th Apr 2005 02:19 PM
Windows XP services stop automatically Jaco Swart Windows XP General 2 29th Apr 2005 06:44 PM
Windows Installer Service problem =?Utf-8?B?cm1lZGlkaQ==?= Microsoft Windows 2000 MSI 0 21st Sep 2004 05:45 PM
Windows Installer Service problem Dave Windows XP Help 6 5th Apr 2004 09:28 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:37 PM.