views:

280

answers:

2

How to communicate between 2 WCF services hosted on 2 different machines.

+1  A: 

Easy! With WCF!

Add a service reference to each of them pointing to the other and you're done.

Mehrdad Afshari
A: 

The question is a little vague, because it really depends on what you're looking to communicate between the two machines, and what binding you're using.

The first way I'm interpreting the question is that Service A needs to communicate with Service B and vice-versa. The simplest way is to have Service A be a client of Service B, and Service B be a client of Service A. When the host starts up each service it also opens the client proxy for communication. This would work regardless of the binding used.

The second way I'm interpreting the question is that Service A needs to be a client of Service B, but allow Service B to call back to Service A. Simply modifying the service contract to include callback contracts should suffice for this. Of course this wouldn't work for all bindings, especially not if you're using message queues.

Agent_9191