Saturday 15 February 2014

c# - Calling a windowsservice ExecuteCommand to excute a OnCustomCommand on itself? -


ServiceController.ExecuteCommand can be used to send custom commands for a Windows service in C #. Service controller myService = new service controller ("MySwive");

myService.ExecuteCommand (200);

I also understand that the command number should be between 128 and 256.
That's why I tried to do this with both service name and service display name, but the window service crashed both times, it is not caught in an attempt to capture it. And Event Weaver says - "MyService service is unpredictable It's finished, it's done 1 time. "

So my question is - is it possible for the Windows service to call ExecuteCommand to call OnCustomCommand () in the same Windows service?

Thanks -

Yes, this is possible for this. I did it once, where a WCF service was hosted in a Windows service, which was called the method of hosting using the exempt command. If you need help with syntax, then I would like to see the code that you are working now.

No comments:

Post a Comment