WCF: what timeout property to use?

Posted by Tom234 on Stack Overflow See other posts from Stack Overflow or by Tom234
Published on 2009-09-23T06:13:12Z Indexed on 2010/03/26 23:03 UTC
Read the original article Hit count: 318

Filed under:
|
|

I have a piece of code like so

            NetTcpBinding binding = new NetTcpBinding(SecurityMode.Transport);
            binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
            binding.CloseTimeout = new TimeSpan(0, 0, 1);
            binding.OpenTimeout = new TimeSpan(0, 0, 1);
            binding.SendTimeout = new TimeSpan(0, 0, 1);
            binding.ReceiveTimeout = new TimeSpan(0, 0, 1);

            EndpointAddress endPoint = new EndpointAddress(new Uri(clientPath));

            DuplexChannelFactory<Iservice> channel = new DuplexChannelFactory<Iservice>(new ClientCallBack(clientName), binding, endPoint);
            channel.Ping()

When the endpoint doesn't exist it still waits 20seconds before throwing an EndpointNotFoundException.

The weird thing is that when i changed the SendTimeout the exception message changed from The connection attempt lasted for a time span of 00:00:20 to ....01 but still took 20seconds to throw the exception!

How can i change this timeout?

© Stack Overflow or respective owner

Related posts about wcf

Related posts about .NET