简体   繁体   中英

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?

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.

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

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM