Question

I am trying use protobuf-net serialization with wcf I have added the necessary configuration settings on client app.config and server web.config, decorated objects and the service interface. I am using fiddler to examine the request and response. The request is using proto serialization but the response from the wcf service uses datacontractserializer. I am able to serialize and deserialize the onjects outside the wcf service.

Any suggestions on what I could be doing wrong? Thanks in advance

@Marc Gravell - Would yo be able to help with this? I have been able to configure Proto Serialization without issues before but I am running into issues this time. Below are the app.config(relevant portions) and web.config Web.config

   <extensions>
        <behaviorExtensions>
        <add name="protobuf" type="ProtoBuf.ServiceModel.ProtoBehaviorExtension, protobuf-net" />
       </behaviorExtensions>
   </extensions>

    <behavior name="ProtoLargeDataEndpointBehavior">
      <dataContractSerializer maxItemsInObjectGraph="2147483647" />
      <protobuf />
    </behavior>
    <behavior name="LargeDataEndpointBehavior">


     <service name="EOG.Modules.Cashflows.DataServices.CashflowAcrossStreamsService" behaviorConfiguration="DebugServiceBehavior">
    <endpoint address="" binding="netTcpBinding" bindingConfiguration="InsecureTcp" behaviorConfiguration="LargeDataEndpointBehavior" contract="EOG.Modules.Cashflows.Common.Interfaces.ICashflowAcrossStreamsService" />
    <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
    <endpoint address="proto" binding="netTcpBinding" bindingConfiguration="InsecureTcp" behaviorConfiguration="ProtoLargeDataEndpointBehavior" contract="EOG.Modules.Cashflows.Common.Interfaces.ICashflowAcrossStreamsService" />

    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttp" behaviorConfiguration="LargeDataEndpointBehavior" contract="EOG.Modules.Cashflows.Common.Interfaces.ICashflowAcrossStreamsService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    <endpoint address="proto" binding="basicHttpBinding" bindingConfiguration="basicHttp" behaviorConfiguration="ProtoLargeDataEndpointBehavior" contract="EOG.Modules.Cashflows.Common.Interfaces.ICashflowAcrossStreamsService" />
  </service>


   App.config
   <endpointBehaviors>
    <behavior name="proto">
      <protobuf />
    </behavior>
    <behavior name="LargeDataEndpointBehavior">
      <dataContractSerializer maxItemsInObjectGraph="2147483647" />
    </behavior>
    <behavior name="ServiceBehavior">
      <dataContractSerializer maxItemsInObjectGraph="2147483647" />
    </behavior>
    <behavior name="ProtoServiceBehavior">
      <dataContractSerializer maxItemsInObjectGraph="2147483647" />
      <protobuf />
    </behavior>
  </endpointBehaviors>

 <extensions>
  <behaviorExtensions>
    <add name="protobuf" type="ProtoBuf.ServiceModel.ProtoBehaviorExtension, protobuf-net" />
  </behaviorExtensions>
 </extensions>
   <endpoint address="http://server_name/iEconLiteServices/CashflowService.svc/proto" behaviorConfiguration="ProtoServiceBehavior" binding="basicHttpBinding" bindingConfiguration="basicHttp" contract="EOG.Modules.Cashflows.Common.Interfaces.ICashflowAcrossStreamsService" />

Below is a screenshot from fiddler that shows the request being serialized in proto and the response with Datacontractserializer.

https://drive.google.com/file/d/0B1IidY-dzmRLYV9vdDNaTm4wNzg/edit?usp=sharing

Any insight would be appreciated.

Était-ce utile?

La solution

The issue turned out to be that the Contract method was returning a type of object instead of a specific type.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top