I need to organize windows service which should interacts with applications next way:
Application generate message, then somehow send this message to running service (there is actually the question. How? Sockets? Other?), and then service do some work with this message.
It’s possible that applications could use some intermediate layer – an executable application which accept message as the parameter, and then send it to service.
So how my service can interact with applications?
Some suggestions:
Host a WCF service in your Windows Service. A detailed example can be found here. The binding (Http, Tcp, Named pipes, etc.) is dependent on the calling application, all will work seamlessly. WCF is Micorosoft’s unified programming model, so this is the recommended approach.
If you are restricted to .NET 2.0 or older, your Windows service could implement a polling mechanism to scan for ‘messages’ from the application. E.g. Your application could insert a new record into a database which is being monitored by the Windows service.
Hope this helps.