2014-01-30 103 views
0

我試圖與WCF 使用protobuf網系列化我加入了對客戶端的app.config和服務器的web.config,裝飾物品和服務接口必需的配置設置。 我正在使用提琴手來檢查請求和響應。請求使用原型序列化,但來自wcf服務的響應使用datacontractserializer。 我可以序列化和反序列化wcf服務之外的對象。protobuf網WCF響應

關於我可能做錯什麼的建議? 在此先感謝

@Marc Gravell - 你能幫助嗎?我可以在沒有問題的情況下配置Proto Serialization,但這次我遇到了問題。下面是在app.config(相關部分)和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" /> 

下面是從提琴手的屏幕截圖示出在原和與DataContractSerializer的所述響應被序列化的請求。

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

任何有識之士將不勝感激。

回答

0

問題原來是Contract方法返回的是一種對象而不是特定的類型。