masoud ramezani
masoud ramezani

Reputation: 22920

Can I use WCF for communicating (sending message) between 2 windows service?

Can I use WCF for communicating between 2 windows service? If yes, How?

Upvotes: 1

Views: 677

Answers (3)

Johann Blais
Johann Blais

Reputation: 9469

It depends on the type of message you want to transfer. There is a lot of possible solutions:

  • MSMQ messages
  • Duplex contracts
  • Named pipes

Basically you need to setup a WCF service on each windows service. You can use the WCF 4.0 discovery features to dynamically find the each service.

Upvotes: 3

carlosfigueira
carlosfigueira

Reputation: 87238

Sure; you'd usually define a service contract (interface) which the two services will use to exchange messages; then one of the windows services would host a WCF service (in this case, where the two services are in the same machine, you'd usually use a local-only binding, such as named pipes). Then the second win service can act as a client for the WCF service on the other windows services. Is there any specific issue you're facing?

Upvotes: 2

Farshid Zaker
Farshid Zaker

Reputation: 1990

Yes, It is possible. You can use ServiceHost class to host a WCF service in a windows service without dependency to IIS.

Upvotes: 2

Related Questions