我正在尝试将 protobuf 设置为 wcf 的序列化程序。我已将以下元素添加到我的服务的 web.config 中
<behavior name="ProtoBufSerializationBehavior">
<protoBuf/>
</behavior>
<extensions>
<behaviorExtensions>
<add name="protoBuf" type="ProtoBuf.ServiceModel.ProtoBehaviorExtension, protobuf-net"/>
</behaviorExtensions>
</extensions>
但是,在尝试浏览我的端点时出现以下错误
无法将行为扩展“protoBuf”添加到名为“ProtoBufSerializationBehavior”的服务行为,因为底层行为类型未实现 IServiceBehavior 接口(interface)。
我的服务端点目前甚至没有使用此行为配置
我确信我做错了一些愚蠢的事情,但似乎找不到它。
最佳答案
成功了,我的行为需要位于端点行为集合中,而不是服务行为
关于c# - ProtoBuf WCF 行为的配置错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17213972/