What is the easiest way to ping/notify a .NET Windows Service?
What is the easiest way to ping/notif开发者_JAVA技巧y a .NET Windows Service? Do I have to use WCF for this? Or is there an easier way? I would like to be able to wake up the service using a Python (or an Iron Python) script from anywhere. Also is there a way I can be notified (by email) if that the service has stopped?
- There is a command line tool SC which can be used start stop and query the service.
- I don't know if there is an easy way to use WMI from python but WMI provides the ability to control services remotely as well.
- If you want to use .net use the ServiceController Class.
If you want to go to the low level .NET socket stuff, you could use the framework's TcpListener class. See an involved tutorial here. To host it in a Windows Service, check out this article.
I had to host a WCF in the windows service to allow it to be notified remotely. Just to keep deploying the solution as simple as possible. using the ServiceController would require the correct setup of permissions
精彩评论