Setting It Up (WCF) - maingi4/ProtoBuf.Services GitHub Wiki

The code includes a sample project "ProtoBuf.Wcf.Sample" to demonstrate the sample usage. The test project is a sample client.

Steps for servers:

  1. Add an endpoint such as this:

<endpoint address="http://localhost:12034/TestService.svc" binding="protoBufBinding" behaviorConfiguration="protoBinding" bindingConfiguration="test" contract="ProtoBuf.Wcf.Sample.ITestService"> </endpoint>

  1. The extensions section (under System.ServiceModel) should look like this:

<extensions>
<bindingExtensions>
<add name="protoBufBinding"
type="ProtoBuf.Services.Wcf.Bindings.ProtoBufBindingCollectionElement, ProtoBuf.Services.Wcf, Version=2.0.0.0, Culture=neutral" />
</bindingExtensions>
<behaviorExtensions>
<add name="protoBufFormatterBehaviour"
type="ProtoBuf.Services.Wcf.Bindings.ProtoBufBindingEndpointBehaviour, ProtoBuf.Services.Wcf" /> </behaviorExtensions>
</extensions>

  1. Optionally you can configure the binding (under the "bindings" section in System.ServiceModel):

<protoBufBinding>
<binding name="test" closeTimeout="00:10:00" openTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="655360" maxBufferPoolSize="5242880" maxReceivedMessageSize="655360">

</binding>
</protoBufBinding>

  1. Make sure the host wcf project has references to the nuget package "ProtoBuf.Services.WCF" (https://www.nuget.org/packages/ProtoBuf.Services.WCF/)

Steps for clients:

Follow the exact same steps as for the server, although the endpoint would be in the "clients" section rather than in the "service" section.

Presto, we are done!

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