Configurations (WCF) - maingi4/ProtoBuf.Services GitHub Wiki

For basic configurations and a guide on how to set it up look here.

Binding Configurations

You can configure the binding just like any other binding, the protoBuf binding currently supports http transport only and inherits most of its configurations as well. An example of binding configuration is given below:

<protoBufBinding>
<binding name="test" closeTimeout="00:10:00" openTimeout="00:10:00"
sendTimeout="00:10:00" maxBufferSize="655360" maxBufferPoolSize="5242880"
maxReceivedMessageSize="655360" compressionType="None">
<operationBehaviours>
<add operationName="GetDataUsingBigDataContract" compressionType="Zip"/>
</operationBehaviours>
</binding>
</protoBufBinding>

Most of these settings are the same as what you would find in a basicHttpBinding configuration so I'm not gonna explain them in detail, however I am gonna focus on things that you don't find there.

compressionType

Available options: None, Zip, Deflate
Default: None

Compression can be set up in the entire binding and can also be overridden in a operation to operation basis (see example above).

One important thing to note is that you can choose to set up a different algorithm of compression at any point in time without changing anything in the client, when compression is setup, the message packet sent to the client has a header telling the type of compression (if any) that the message data uses and hence can seamlessly work without having to change your client. The clients can do exactly the same as well! Important thing to derive from this is that server can decide to compress its reply at any point in time but the incoming request can be set up for compression by the client only, also at any point in time without any changes required at the servers end.

Choosing the Compression Algorithm

None Means no compression.
Zip Uses the standard gZip algorithm. The packet size is small yet bigger than deflate, use this when global standards is important.
Deflate A .Net variant of the gZip algorithm, its the same except for some header information which is missing and assumed, the resultant packet is smaller than Zip, however this is not a standard.

Zip & Deflate are natively supported by .Net and hence requires no additional reference.


Would message inspectors and other WCF extensions work with this binding?

Yes. Just do them like you would for any other binding / endpoint.

⚠️ **GitHub.com Fallback** ⚠️