Chinh Do

Using a Different Configured Binding in WCF Client

First time here? Check out my greatest hits or look around in the archives, and consider subscribing to the latest posts via RSS or email. Thanks for visiting.
6th February 2010

Using a Different Configured Binding in WCF Client

To programmatically switch bindings on the fly, you can do it via the constructor of the generated client:

var client = new WeatherClient(“MyEndpoint”);

“MyEndpoint” is the name of the endpoint defined in your config file:

<client>
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="http1" contract="MyContract" name="MyEndpoint" />
</client>

posted in Dotnet/.NET - C#, Programming | 0 Comments