I have a WCF client which uses a wsHttpBinding, I would like to enable http keep-alive.
I\'m hoping I can turn this on by just changing the client config... I\'ve fo
You'll have to use a custom binding in order to disable the Keep-Alive header, since that feature is not exposed in any of the built-in binding classes.
The easiest way to achieve this without having to define a custom binding from scratch, is to customize the existing BasicHttpBinding or WSHttpBinding instance associated to the client proxy in code.
Here's an example:
var proxy = new MyServiceClient();
var customBinding = new CustomBinding(proxy.Endpoint.Binding);
var transportElement = customBinding.Elements.Find();
transportElement.KeepAliveEnabled = false;
proxy.Endpoint.Binding = customBinding;