Re: Service Problem - service on local computer started and then s

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



This behaviour is typical for when an exception is thrown on startup. Maybe
there's something wrong with the EventLog.Write call?

Like Kevin said, Try/Catch is a good idea.

--
Robert Jeppesen
Durius
http://www.durius.com/
"Grigs" <Grigs@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:9433C395-4AAB-4466-8FD9-B930C12F4586@xxxxxxxxxxxxxxxx
> Kevin, I will try a try-catch block, but as I mentioned, all I am doing is
> an
> EventLog.Write method in the OnStart, OnStop and the timers elapsed event.
> But perhaps there is something going wrong there and will try it.
>
> As for debugging the service, that only works if you can get the service
> started. Lucky me, I can't even get that far.
>
> I just tried it on yet another machine and it works like a champ.
>
> Ugh, more help needed I am afraid. I will post after I do the above.
> --
> Thanx,
> Grigs
>
>
> "Kevin Spencer" wrote:
>
>> You didn't mention anything about exception handling in your service. As
>> a
>> service has no visible user interface, having the service at least write
>> log
>> entries when something goes awry is a good idea. Using try/catch, and
>> handling exceptions well is virtually imperative.
>>
>> If you have Visual Studio.Net, you can also attach to the Service process
>> to
>> debug it.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> ..Net Developer
>> If you push something hard enough,
>> it will fall over.
>> - Fudd's First Law of Opposition
>>
>> "Grigs" <Grigs@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:DE7870A8-4AF8-44CA-857B-014E0998729D@xxxxxxxxxxxxxxxx
>> > Hello,
>> >
>> > I have created Windows Services before using C# and have had no
>> > problems.
>> > Not to mention, the one I currently am having problems with worked
>> > great
>> > for
>> > the first 3 days. Then I added some more SQL code and went to test it
>> > again
>> > and now whenever I start the Service up I get the following error
>> > message...
>> >
>> > The <xxx> service on local computer started and then stopped...
>> >
>> > I tried a few things like removing the new code and such without any
>> > success. I even wound up creating a brand new Project as a Windows
>> > Service
>> > and all this one does at the moment is wait for a timer to elapse in 10
>> > seconds and then it will write an entry to the log file. I also have
>> > it
>> > logging at OnStart and OnStop. None of the logging happens.
>> >
>> > Since there is really no code other than event log stuff in the new
>> > project,
>> > I have to assume it is some other something that is halting my service.
>> > this
>> > is really killing my time and any solution would be Greatly
>> > appreciated.
>> >
>> > Further information:
>> >
>> > I just took the slimed down version of the Windows Service to another
>> > machine. Did the InstallUtil and started it. It started and did the
>> > logging
>> > as expected. I then manually stopped it and all went as it should.
>> >
>> > Nothing my event logs seems to point to anything that is of any use.
>> > The
>> > application log has nothing in it when I attempt to start it. The
>> > System
>> > has
>> > two events (7035 - Successfully sent a start control) then right after
>> > that
>> > is (7036 - entered the stopped state.)
>> >
>> > I tried to run it in Safe Mode but it would not let me start that
>> > service
>> > in
>> > Safe Mode.
>> >
>> > PLEASE help
>> > --
>> > Thanx,
>> > Grigs
>>
>>
>>


.



Relevant Pages

  • Re: Logging (exceptions etc)
    ... In addition to the other comments about using the Exception Management ... I normally do my logging in a global exception handler. ... Also I use try/finally & using more then I use try/catch. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: RFD: How To Recognize Bad Javascript Code
    ... error in the contents of one script element does not interfere with the successful interpretation/compilation of syntax error free code in other script elements within the same document. ... So any residual compatibility issue is really just in relation to very old web browsers; mostly the forth generation of browsers and their antecedents. ... javascript's try/catch construct is nearly totally useless for various reasons. ... In Java (and other languages with good exception handling support) you can be very specific about which exceptions you catch and handle. ...
    (comp.lang.javascript)
  • Re: Re: kern/99979: Get Ready for Kernel Module in C++
    ... in a jmpbuf -which are restored after a longjmp(). ... try/catch stores less. ... the instruction pointer and stack pointer, ... They are called "exception" ...
    (freebsd-hackers)
  • Re: Error handlers and Exception handlers
    ... There have been many a thread of the benefits of Try/Catch verses On Error, ... Otherwise I let my global exception handlers handle the event. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Exception in finally block
    ... try/finally inside of a try/catch. ... throw both XXException and IOException from processXX? ... and then rethrowing the exception. ...
    (comp.lang.java.programmer)