WSHttp 绑定和 ReliableSession / MaxRetryCount
在启用了可靠会话的 WCF 中使用 WSHttpBinding
时,我的服务引用会自行更新为:
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="true">
</reliableSession>
只要绑定配置为 WSHttpBinding,我就无法将 maxRetryCount
属性添加到可靠会话中。
现在我的问题是:使用 WSHttpBinding 时 maxRetryCount 的值是多少,有什么方法可以在配置中更改它;不使用 CustomBinding?
When using a WSHttpBinding
in WCF with reliableSessions enabled, my service reference updates itself to:
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="true">
</reliableSession>
I cannot add the maxRetryCount
attribute to the reliableSession as long as the binding is configured as a WSHttpBinding.
Now my question: what is the value of maxRetryCount
when using a WSHttpBinding, and is there any way to change this in config; without the use of a CustomBinding?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法在标准
wsHttpBinding
配置上设置maxRetryCount
。为了设置该值,您需要创建一个单独的自定义绑定,然后从您的服务或客户端配置中引用它:定义自定义绑定并不难 - 但您需要确保指定组成绑定的元素按照正确的顺序 - 请参阅有关自定义绑定的 MSDN 文档以获取参考。
如果您想在服务器和客户端之间共享自定义绑定配置,您还可以将该
部分放入单独的bindings.config
文件中,然后引用该文件来自 web.config/app.config 的外部文件:Visual Studio 会抱怨这一点并显示红色波浪下划线 - 但相信我 - 该技术有效,我每天在生产中使用它(描述配置内容的 Visual Studio XML 模式不是不完整和准确)。
马克
You cannot set the
maxRetryCount
on a standardwsHttpBinding
configuration. In order to set that value, you need to create a separate custom binding and then reference that from your service or client config:Defining a custom binding isn't hard - but you need to make sure you specify the elements that make up the binding in the right order - see the MSDN docs on custom bindings for a reference.
If you want to share the custom binding configuration between server and client, you could also put that
<bindings>
section into a separatebindings.config
file, and then reference that external file from your web.config/app.config:Visual Studio will complain about this and show red squiggly underlines - but trust me - the technique works, I use it in production every day (the Visual Studio XML schema describing the config stuff isn't complete and accurate).
Marc