WCF超时客户端与服务器
谁能向我解释一下服务器上的超时配置与客户端上的超时配置有什么区别?例如,如果客户端将 sendTimeout 设置为 5 分钟,而服务器上的配置将其设置为 1 分钟,会发生什么情况?客户发起沟通后是否占上风?
感谢您的帮助 !
Can anyone explain to me what is the difference between the timeout configuration on the server vesus on the client ? For example, what would happen if a client sets the sendTimeout to 5 minutes while the configuration on the server has it set for 1 minute ? Does the client prevail since it initiates the communication ?
Thanks for your help !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想我明白了,看看 http:// /omsite.blogspot.com/2008/04/playing-with-wcf-nettcpbinding-timeouts.html。
当客户端向服务器发起调用时,客户端sendTimeout和服务器端receiveTimeout生效。客户端必须在服务器上设置的 receiveTimeout 到期之前发送(或推送)所有数据。服务器必须在客户端设置的 sendTimeout 到期之前完成其操作并将结果返回给客户端。
如果角色颠倒,意味着服务器正在打开与客户端的通信(例如在回调中等),则服务器上的 sendTimeout 和客户端上的 receiveTimeout 就会发挥作用。
还有 OpenTimeout 和 CloseTimeout 控制通道连接建立超时并在较低通道级别(线路套接字等)下工作
I think I got this, take a look at http://omsite.blogspot.com/2008/04/playing-with-wcf-nettcpbinding-timeouts.html.
When client initiates the call to server, the client side sendTimeout and server side receiveTimeout are in effect. The client has to send(or push) all the data before receiveTimeout set on server expires. The server has to complete its operation and return the results back to client before the sendTimeout set on the client expires.
If the roles are reversed, meaning server is opening communication back to client (like in a callback etc), then sendTimeout on server and receiveTimeout on client come into play.
There is also OpenTimeout and CloseTimeout which control the channel connection establishing timeouts and work at lower channel levels (line sockets etc)
在测试您询问的场景。请求的超时时间为5分钟,在客户端定义
On the Client-side Timeouts
SendTimeout – 用于初始化OperationTimeout,它控制整个发送过程消息,包括接收请求/回复服务操作的回复消息。当从回调合约方法发送回复消息时,此超时也适用。
ReceiveTimeout – 未使用
服务端超时
SendTimeout 与客户端相同
ReceiveTimeout – 使用由服务框架层初始化会话空闲超时,该超时控制会话在超时之前可以空闲的时间。
请参阅 https ://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/configuring-timeout-values-on-a-binding
In tests the scenario that you asked. The timeout of the request is 5 minutes, which was defined in the client
On the Client-side Timeouts
SendTimeout – used to initialize the OperationTimeout, which governs the whole process of sending a message, including receiving a reply message for a request/reply service operation. This timeout also applies when sending reply messages from a callback contract method.
ReceiveTimeout – is not used
On the Service-side Timeouts
SendTimeout are the same as on the client
ReceiveTimeout – used by the Service Framework Layer to initialize the session-idle timeout which controls how long a session can be idle before timing out.
See https://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/configuring-timeout-values-on-a-binding