Friday, August 8, 2008

.NET Web Service request timeout setting

There are 3 timeout in play:
  1. Proxy timeout
  2. Client executionTimeout
  3. Server executionTimeout

Proxy timeout can be set programmatically on the client side when create proxy object

MyWebService svr = new MyWebService();
svr.Timeout = 100;

The timeout setting is in seconds and default is 100 seconds, if you want to set it to indefinite then set it to -1.

ExecutionTimeout setting is found in the web.config or machine.config on both client and server side

following can be found in the web.config
<configuration>
<system.web>
<httpRuntime executionTimeout="90" maxRequestLength="4096"
useFullyQualifiedRedirectUrl="false"
minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="100" />
</system.web>
</configuration>



following can be found in the machine.config
<httpRuntime
executionTimeout="90"
maxRequestLength="4096"
useFullyQualifiedRedirectUrl="false"
minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="100" />

The default for executionTimeout is 90 seconds.

NOTE: it is recommanded (best practice ) to set proxy timeout greater than executionTimeout