WCF timeout types

Published on Monday, November 8, 2010

When you use WCF binding, you will see different timeout types:

OpenTimeout
CloseTimeout
SendTimeout
ReceiveTimeout
InactivityTimeout
...

Brief summary of binding timeout knobs…

Client side:

* SendTimeout is used to initialize the OperationTimeout, which governs the whole interaction for sending a message (including receiving a reply message in a request-reply case).  This timeout also applies when sending reply messages from a CallbackContract method.
* OpenTimeout and CloseTimeout are used when opening and closing channels (when no explicit timeout value is passed).
* ReceiveTimeout is not used.

Server side:

* Send, Open, and Close Timeout same as on client (for Callbacks).
* ReceiveTimeout is used by ServiceFramework layer to initialize the session-idle timeout.

above content from here

Also, there is another blog from Microsoft MSDN blog: PollingDuplex multiple mode timeouts demystified

ServerPollTimeout

* Set it here
      o System.ServiceModel.PollingDuplexHttpBinding.ServerPollTimeout
      o System.ServiceModel.Channels.PollingDuplexBindingElement.ServerPollTimeout
* Definition: Time the server holds the poll request prior to sending an empty poll response to the client. After the first outgoing server-to-client application message (either server response to request coming from client or request coming from the server) gets sent, this timer stops being used, and MaxOutputDelay kicks in. Bound to the client dispatcher (HTTP request / response)
* Default: 15 s

MaxOutputDelay

* Set it here
      o System.ServiceModel.PollingDuplexHttpBinding.MaxOutputDelay
      o System.ServiceModel.Channels.PollingDuplexBindingElement.MaxOutputDelay
* Definition: Time between the last outgoing server-to-client application message and the HTTP response being closed; it’s reset with each new outgoing message being dequeued. Closing the response ensures that all messages are flushed and no message will take longer than MaxOutputDelay to be delivered to the client. Bound to the client dispatcher.
* Default: 200 ms

PollHeartbeatTimeout

* Not settable – this is an internal property
* Definition: Timer which is started when a poll response is sent to the client, and stopped when the next poll for that dispatcher is received. Bound to the client dispatcher. If the timeout is reached, all the channels bound to the dispatcher are faulted. This is how we determine if a client "is still there".
* Value: 4 * ServerPollTimeout + 30 s

InactivityTimeout

* Set it here
      o System.ServiceModel.PollingDuplexHttpBinding.InactivityTimeout
      o System.ServiceModel.Channels.PollingDuplexBindingElement.InactivityTimeout
* Definition: Timer which is reset when an application messages is received by the channel. If the timeout is reached, the channel is faulted. Bound to the client session. Note that this not affected by polls, contrary to the way this same timeout behaves with infrastructure messages on other bindings (as described here). So effectively this is the same as ReceiveTimeout.
* Default: 10 min

ReceiveTimeout

* Set it here
      o System.ServiceModel.Channels.Binding.ReceiveTimeout
* Definition: Timer which is reset when the ServiceModel layer pumps an application message from a PollingDuplex channel. If the timeout is reached, the channel is aborted. Infrastructure messages such as polls don’t affect this timeout. Bound to the client session (channel).
* Default: 10 min

On the client side, we also have some timeouts that may be of interest. All class and member names below refer to the client-side System.ServiceModel.PollingDuplex.dll that ships in the “Client” folder of the Silverlight SDK. ClientPollTimeout

* Set it here
      o System.ServiceModel.Channels.PollingDuplexBindingElement.ClientPollTimeout
* Definition: Time the client will wait for a response to a poll ; if the server takes longer to respond, the client will fault the channel. This is bound to the dispatcher, so it will fault all channels in the same dispatcher.
* Default: 5 min

InactivityTimeout

* Set it here
      o System.ServiceModel.Channels.PollingDuplexBindingElement.InactivityTimout
* Definition: Timer that is reset when an application message is received on the client. Bound to the session.
* Default: 10 min