Hi
I've got a WCF service which has multiple clients that it connects to.
What I want to do is to create the clients dynamically the WCF services consumes.
Creating the clients by inheriting from the ServiceFactory<TChannel>
class is done and very simple. What I'm struggling with is how to read Endpoint behaviours from the web.config
file and add them to the clients?
Code file
BasicHttpBinding binding = new BasicHttpBinding(bindingConfigName);
EndpointAddress endpoint = new EndpointAddress(endpointUrl);
ChannelFactory<IShoppingSoap> clientEndpoint = new ChannelFactory<IShoppingSoap>(binding, endpoint);
base.Endpoint.Behaviors.Add(*Get the behavior from the config file*);
return base.CreateChannel();
Web.config
file :
<behaviors>
<endpointBehaviors>
<behavior name="EndpointBehaviour_GmCustom">
<dataContractSerializer maxItemsInObjectGraph="2147483646" />
<behavior>
</endpointBehaviors>
</behaviors>