Friday, October 12, 2012

Setting Timeouts in WCF Service-Client side for a long running process


With a WCF service and its client, often I forget which timeout should be set on which side..?
There are four types of timeout parameters which we set in a WCF service:
• closeTimeout (Default value: 00:01:00)
• openTimeout (Default value: 00:01:00)
• receiveTimeout (Default value: 00:10:00)
• sendTimeout (Default value: 00:01:00)


Here is a thumb rule (at least for my need to run a long process :)

To execute a long running process, we need to set “receiveTimeout” on Service side same as “sendTimeout” on the client side.
For example we could set “00:30:00” (30 minutes)


For more details, here are definitions from MDSN:

Client-side Timeouts

On the client side:
1. 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.
2. OpenTimeout – used when opening channels when no explicit timeout value is specified
3. CloseTimeout – used when closing channels when no explicit timeout value is specified
4. ReceiveTimeout – is not used


Service-side Timeouts

On the service side:
1. SendTimeout, OpentTimeout, CloseTimeout are the same as on the client
2. 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.

1 comment:

  1. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Windows foundation communication, kindly contact us http://www.maxmunus.com/contact
    MaxMunus Offer World Class Virtual Instructor led training on Windows foundation communication. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us:
    Name : Arunkumar U
    Email : arun@maxmunus.com
    Skype id: training_maxmunus
    Contact No.-+91-9738507310
    Company Website –http://www.maxmunus.com



    ReplyDelete