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.
- 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>
- 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>
- 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>
- Make sure the host wcf project has references to the nuget package "ProtoBuf.Services.WCF" (https://www.nuget.org/packages/ProtoBuf.Services.WCF/)
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!