Load balancing WCF with basicHttpBinding can be done using the keepAliveEnabled property when there is connection reuse. Basically this property when enabled, enables a client to maintain a persistent connection with the service and gives enhanced throughput with connection reuse with multiple messages. But in a load balanced farm we cannot have a client strongly associated with a server and so need to disable this property.
This can be accessed through a custom binding as follows.
<httpTransport keepAliveEnabled=“false“ />
BindingElementCollection bec = new BasicHttpBinding().CreateBindingElements();bec.Find<HttpTransportBindingElement>().KeepAliveEnabled = false;CustomBinding cb = new CustomBinding(bec);