Rade Jaramaz

Hi,

I have made windows service and windows application to control this service. I have used custom commands to tell windows service what to do and ServiceController class to start/stop/pause this service.

Now, I need to get data from windows service, more detailed information about its status and job which is being done at that moment.

How can I get data from windows service on request
e.g. Windows service has some job to do, and I want to display some indicator which will tell user how much job is done (56% done...) and which job is being done. This would require windows service to return value on request/custom command from windows application.

I could send custom command to windows service on which service would write data that I need to file, and then windows application would read that data, but I think this shouldn't be done like that.

Thank you all for your help,
Rade



Re: Visual C# General Windows service & Windows forms (C#)

houtexwebdev

You have 2 options here:

1) Remoting. Have your service marshall a class that can be used to query the state of the service and exposes methods that a windows application can call to perform different functions or:

2) Instrument your application to WMI via system.management.dll

I'd have the first option unless you have an explivit need for the second (e.g. the app needs to be administered and monitored via M.O.M.).





Re: Visual C# General Windows service & Windows forms (C#)

Rade Jaramaz

Thank you for your fast answer and help! :-)
I will have to read about Remoting and learn how it can be done. I needed to know where to start searching for an answer.

Regards,
Rade





Re: Visual C# General Windows service & Windows forms (C#)