If my service fails to start, I'd like to notify the user and either display
an error or direct them to check the event log to see more info. With
Win32, you could return a non-0 number to the SCM during startup and a
dialog would be displayed (by the SCM) showing the error number and
directing the user to check the error log for further information.

Is there similar functionality in .NET? I've tried throwing exceptions and
calling Environment.Exit([some number]) in OnStart(), but both cause the SCM
to display some useless dialog.

How are you guys handling this?
-Joel

Re: Gracefully fail to start a service by Nick

Nick
Sat May 29 12:58:11 CDT 2004

Having the service display a message its very tricky, because (typically)
services are started on an different Windows Station than the one hooked up
to the monitor and keyboard. Even if you do put up a message box, you one
will see it (and perhaps worse, no one can respond to it).

Logging an error message and throwing an exception is your best bet. Yes,
the message is not good (it implies that there might *not* be a problem).

Nick.

"Joel Lyons" <NOSPAMJOELL@NOVARAD.NET> wrote in message
news:%23e1xvGfQEHA.3524@TK2MSFTNGP09.phx.gbl...
> If my service fails to start, I'd like to notify the user and either
display
> an error or direct them to check the event log to see more info. With
> Win32, you could return a non-0 number to the SCM during startup and a
> dialog would be displayed (by the SCM) showing the error number and
> directing the user to check the error log for further information.
>
> Is there similar functionality in .NET? I've tried throwing exceptions and
> calling Environment.Exit([some number]) in OnStart(), but both cause the
SCM
> to display some useless dialog.
>
> How are you guys handling this?
> -Joel
>
>