Load Balanced Web Service Bindings


What options can I use with WSHttpBinding to make it friendlier to load balancing?

The primary difficulty encountered when using WSHttp with a load balancer is that WSHttp is easy to configure to produce application-level sessions between the client and service.

Many load balancers support the concept of sticky sessions, which pins the traffic from a client to a particular machine after the first exchange. This pinning is predictive though as very few general-purpose load balancers do the necessary record keeping and protocol parsing to unambiguously route sessions. It’s possible for the load balancer to associate both too few messages with the session, causing an error when one of the messages is processed without the session context, as well associate too many messages with the session, causing an uneven distribution of load.

Going in the other direction, you can also look to avoid using the features that result in creating application-level sessions. On the WSHttp binding, reliable messaging and message level security are the two sources of application-level sessions.

The use of reliable messaging is controlled by the ReliableSession property (and defaults to optional).

The use of message security is controlled by the Security property (and defaults to enabled). Alternatives to the default message security settings are to use transport security, by setting the Security.Mode property to Transport, or to use non-sessionful message security, by setting the Security.Message.EstablishSecurityContext property to false.

Skip to main content