My sharing and discussion of topics in C#, WCF, WPF, Winforms, SQL, ASP.Net, Windows Service, Java Script .... with you all.
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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment