gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 11:02:24 24 4
gpt4 key购买 nike

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

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

我确定我做错了一些愚蠢的事情,但似乎无法找到它。

最佳答案

成功了,我的行为需要在 endpointBehaviour 集合中而不是 serviceBehavior 中

关于c# - ProtoBuf WCF 行为的配置错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17213972/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com