2014-01-30 144 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方法返回的是一种对象而不是特定的类型。