c# - ProtoBuf WCF 行为的配置错误

标签 c# protobuf-net

我正在尝试将 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/

相关文章:

c# - 是否可以将 c# 嵌入到微 Controller 中

c# - 数组的数组合并为一个数组 c#

c# - protobuf-net 与 Windows azure(Web 角色)兼容吗?

c# - 使用 protobuf-net 序列化不可变集合

c# - 列表中不同对象类型的数量

C# .NET 设计模式问题

c# - ViewModel 返回默认值 0

c# - 与 protobuf-net 和 C# 的接口(interface)

c# - 使用 protobuf-net 将自定义类序列化为原始类型

c# - protobuf-net:序列化一个空列表