after some research of the source code of the involved WCF classes, we were able to find a pretty good solution for our needs: We are currently using the WSHttpBinding for our bindings. This has a method CreateBindingElements which returns a collection of the used binding elements and can be overridden. So we just derived from the WsHttpBinding class and injected the GZipMessageEncoding into the collection before returning it.
public class GZipWSHttpBinding : WSHttpBinding
{
public override BindingElementCollection CreateBindingElements()
{
BindingElementCollection bec = base.CreateBindingElements();
int index = bec.Count - 1;
while (index >= 0 && !(bec[index] is MessageEncodingBindingElement))
index--;
if (index >= 0)
{
GZipMessageEncodingBindingElement gZipCompression =
new GZipMessageEncodingBindingElement(bec[index] as MessageEncodingBindingElement);
bec[index] = gZipCompression;
}
return bec;
}
}
The only thing left is using this class instead of the WsHttpBinding class in the Windsor installer, and gzip compression is in place.
Best Regards Markus