配置错误与ProtoBuf WCF行为

本文关键字:WCF 行为 ProtoBuf 错误 配置 | 更新日期: 2023-09-27 18:19:16

我正在尝试将protobuf设置为wcf的序列化器。我在我的网页上添加了以下元素。配置我的服务

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

但是,当尝试浏览端点

时,我得到以下错误

不能将行为扩展'protoBuf'添加到名为'ProtoBufSerializationBehavior'的服务行为中,因为底层行为类型没有实现IServiceBehavior接口。

我的服务端点目前甚至没有使用此行为配置

我敢肯定是我做错了什么蠢事,但我似乎找不出来。

配置错误与ProtoBuf WCF行为

让它工作,我的行为需要在endpointbehavior集合而不是serviceBehavior