TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


Forums >


Re: Retrieve Windows Service ExitCode from ServiceController

Gregg Flynn

9/26/2011 4:08:00 PM

Were you ever able to solve this? I am in the same situation, and google-fu has not turned up anything.

> On Monday, June 11, 2007 8:59 PM ERobisha wrote:

> In a C# Application, I'm using a service controller to Start() a
> service also written in .NET.
> In the OnStart() of the Service I may have an occasion to Stop the
> service if something goes wrong, and would like to let the application
> that is attempting to start it know just what went awry.
> As opposed to using something complicated like .NET remoting or some
> other inter app communications, I'd like to simply set the ExitCode
> value in the Service and retrieve it from the ServiceController of the
> starting app.
> However, I see no way to get the exit code from the ServiceController
> instance that's trying to Start() the service.
> Any ideas on how to get the ExitCode?
> I suspect I may have to create a Process object, via
> Process.GetProcessById() or GetProcessByName() and then watch for the
> ExitCode there?
> Thanks
> Eric