WCF Custom Binding by configuration and by Binding, StandardBindingElement and StandardBindingCollectionElement

In the attempt to master the basic topics and extensibility points of WCF, we are going to look to WCF Custom Bindings and their possibilities.

For certain scenario’s, our company would like to use a netHttpBinding, which is not a default binding. Thus our netHttpBinding will be a custom binding which uses BinaryEncoding and HttpTransport, in contrast to the default http bindings which use TextMessageEncoding and HttpTransport. Binary encoding is a proprietary .NET protocol, but in our cases this is not an issue as we don’t have to be interopable. We know the clients are .NET clients, somewhere around the globe and to gain performance at the encoding, we want to use a custom httpbinding that uses binary encoding.

This might not be a ideal scenario, but it is good enough to run past the basic principles.

1. Custom binding by configuration:

Our solutions look as following:

WCF Custom binding solution overview

We have 2 projects in our solution:
“WCF.Binding.Custom.client”: Client console application, used to mimic a client
“WCF.Binding.Custom.Service”: WCF Service Application, with 1 WCF service called “SaasService”

Continue reading

Advertisements