How to call Windows Service from Windows Service in C#.NET?
How to call Windows Service from Windows Service in C#.NET?
开发者_如何学JAVAPlease suggest a code related to the same for calling the Windows service within Windows Service.
If by windows service you me a some code running as service under the service controller. Then any number of API's exist, from WCF, remoting, MSMQ, sockets, etc. all way to shared memory (memory mapped files). If you give us more information as to what you're trying to achieve, then we can probably be more precise.
The preferred way of communication between separate windows apps is WCF - the Windows Communication Foundation which was introduced with .NET 3.0. It supports a wide variety of communication protocols (HTTP, TCP/IP) and offer a vast number of options and possibilities.
It allows you to send messages between two programs - no matter what they are. Windows NT Services are just fine.
In order to exchange messages, you will need to define one program to be the "server" and the other to be the "client". You will also need to define a service contract - an interface that defines the communication service and its methods.
The server part then needs to implement that service, and the client needs to create a proxy for that service, and then then two sides can exchange messages.
精彩评论