You cannot control the DataContractSerializer, but you can control your WCF binding, whether it will be serialized to text or binary.
As you noticed, NetTcpBinding is binary by default and therefore very compact and fast. For Http-based bindings, the default text is the interaction text, and therefore more verbose and less efficient.
But nothing prevents you from creating your own HTTP binding based on binary code - if you agree that compatibility with external clients leaves the window if you do so. This will ONLY work with your own internal clients that use the same custom binding.
Basically, you need to create your own custom binding from scratch - in the code or in the config. In config, this is pretty easy:
<system.serviceModel> <bindings> <customBinding name="binaryHttpBinding"> <binaryMessageEncoding /> <httpTransport /> </customBinding> </bindings> </system.serviceModel>
The two minimum parts that you must specify are the message encoding and the transport protocol — everything else is optional.
Now you can specify your WCF service and client to use this new, custom binary binding over HTTP:
<system.serviceModel> <services> <service name="YourService"> <endpoint address="http://whatever.com:8888/YourAddress" binding=binaryHttpBinding" contract="IYourContract" /> </service> </services> </system.serviceModel>
(and the same also works for the client in the <client> section, of course).
You have it - it's not a matter of managing the DataContractSerializer in your code in any way, form or form - just create a custom binding and use it.
Mark
EDIT (after comments on the left):
Well, WCF is really very extensible, so you can do this as message inspectors when you exit the client. You can write a message inspector (derived from IClientMessageInspector ) that does nothing but check the message and measure its size and write its file or database