Wcf WSHttp绑定和ReliableSession/MaxRetryCount
在启用了reliableSessions的WCF中使用Wcf WSHttp绑定和ReliableSession/MaxRetryCount,wcf,wshttpbinding,ws-reliablemessaging,Wcf,Wshttpbinding,Ws Reliablemessaging,在启用了reliableSessions的WCF中使用WSHttpBinding时,“我的服务引用”将自身更新为: <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="true"> </reliableSession> 只要绑定配置为WSHttpBinding,我就无法将maxRetryCount属性添加到reliableSession 现在我的问题是:当使用WSHttpBind
WSHttpBinding
时,“我的服务引用”将自身更新为:
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="true">
</reliableSession>
只要绑定配置为WSHttpBinding,我就无法将maxRetryCount
属性添加到reliableSession
现在我的问题是:当使用WSHttpBinding时,
maxRetryCount
的值是多少,是否有任何方法可以在配置中更改它;如果不使用CustomBinding?您无法在标准wsHttpBinding
配置上设置maxRetryCount
。为了设置该值,您需要创建一个单独的自定义绑定,然后从服务或客户端配置中引用该绑定:
<system.serviceModel>
<bindings>
<customBinding>
<binding name="wsCustomBinding">
<reliableSession maxRetryCount="15"/>
<textMessageEncoding/>
<httpTransport />
</binding>
</customBinding>
</bindings>
<services>
<service name="MyService">
<endpoint address="http://localhost:7878/MyServoce"
binding="customBinding"
bindingConfiguration="wsCustomBinding"
contract="IMyService" />
</service>
</services>
</system.serviceModel>
VisualStudio会抱怨这一点,并显示红色扭曲的下划线——但请相信我——这种技术是有效的,我每天都在生产中使用它(描述配置内容的VisualStudioXML模式并不完整和准确)
Marc是的,我知道customBinding的解决方法。您是否知道wsHttpBinding上的重试计数值是多少,或者ws-Binding禁用了重试功能?@marc\s什么会导致重试?暂停?服务器异常?硬件错误?(在目标服务上…)wsHttpBinding上maxRetryCount的默认值为8-但它仅在启用可靠会话的情况下处于活动状态。这是可以在客户端和服务器上缓冲的消息数量——乘以您允许的最大消息大小,您就知道“可靠性”缓冲区将有多大。就我所知,除了使用自定义绑定(在app.config/web.config中或通过代码配置)将该值设置为8.Ok以外的其他值之外,没有其他方法。谢谢你指出这一点。
<system.serviceModel>
<bindings configSource="bindings.config">