views:

269

answers:

1

Will it consume from all of them? Will it throw an exception?

+5  A: 

You can have multiple endpoints for the same contract and different addresses in your clieint config, no problem.

They need to be separated by a unique name= attribute on the <endpoint> tag.

<client>
  <endpoint name="tcpEndpoint"
            address="net.tcp://server:8888/SomeService"
            binding="netTcpBinding"
            contract="IYourService" />
  <endpoint name="httpEndpoint"
            address="http://server:8777/SomeService"
            binding="basicHttpBinding"
            contract="IYourService" />
</client>

When you create your client proxy, you need to provide the name of the endpoint you want to use:

YourClient client = new YourClient("netTcpEndpoint");

You can no longer just instantiate your client and expect it to find "the" endpoint to use, since there are multiple (and there's no way to define one as the "default" which gets used if nothing is specified, unfortunately).

Other than that - no problems should arise, I think.

marc_s
ya. wouldn't make sense to connect with ex: basicHttpbinding + wsHttpBinding + netTcpBinding at the same time.
vidalsasoon
@vidal: not really, no :-) But you **could** potentitally have one client going over netTcp, and another client instance going over http - if you ever need to (not sure why that would be needed - but you **could** ;-)
marc_s
If you have a java web client and a .Net thick client for a real life example. The java client uses http and .Net client uses net.tcp
Pratik
@Patrik: yes, sure, in that scenario, it makes total sense. I was just wondering if it would ever make sense to have one .NET client use two different endpoints at the same time....
marc_s