简体   繁体   中英

Set the SendTimeout on a WCF client callback binding?

I have a DuplexClientBase proxy with NetTcpBinding.

I set the SendTimeout on the DuplexClientBase at instantiation:

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.

Is it possible to specify the SendTimeout for the callback proxy?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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