简体   繁体   English

在WCF客户端回调绑定上设置SendTimeout?

[英]Set the SendTimeout on a WCF client callback binding?

I have a DuplexClientBase proxy with NetTcpBinding. 我有一个带有NetTcpBinding的DuplexClientBase代理。

I set the SendTimeout on the DuplexClientBase at instantiation: 我在实例化时在DuplexClientBase上设置了SendTimeout:

public class MyProxy : DuplexClientBase<IService>
{
    public MyProxy(IClient callback, Uri uri)
         : base(callback, new NetTcpBinding() { SendTimeout = TimeSpan.FromSeconds(2.0)}, new EndpointAddress(uri))
        { ... }

The SendTimeout works as expected (client -> server) and the callback mechanism works as expected (server -> client), but the callback SendTimeout is not 2 seconds. SendTimeout按预期方式工作(客户端->服务器),并且回调机制按预期方式工作(服务器->客户端),但是回调SendTimeout并非2秒。

Is it possible to specify the SendTimeout for the callback proxy? 是否可以为回调代理指定SendTimeout?

A-ha! A-HA!

After quite a bit of trial and error, I've found that the SendTimeout on the ServiceHost's NetTcpBinding is what controls the SendTimeout on duplex callbacks. 经过大量的试验和错误之后,我发现ServiceHost的NetTcpBinding上的SendTimeout是控制双工回调上的SendTimeout的因素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM