English

How To: Extend the timeout period of an application

Summary

Occasionally an application requires a longer wait than the default timeout to get back a complex response from ArcWeb Services. The default timeout depends on the Web service toolkit used to build the application:

If an AXIS 1.1 application does not receive a response within 60 seconds, a 'Read timeout' exception displays.

If a .NET application does not receive a response in 90 seconds, the error message, "The operation has timed-out" is returned.

GLUE does not have a default timeout.

Procedure

AXIS 1.1 and later:

Increase the default timeout of 60 seconds through the setTimeout method on the org.apache.axis.client.Stub class. This is the class all emitted stubs extend.

Report loc = new ReportLocator();
IReport report = loc.getIReport();
org.apache.axis.client.Stub s = (org.apache.axis.client.Stub) report;
s.setTimeout(3000000); // 5 minutes, in milliseconds

The first two lines in the above code binds the service, in this case Report Services and the last two lines increase the timeout to five minutes using this sample.

.NET

Change script timeout through ASP.NET configuration files.

The httpRuntime tag in ASP.NET configuration files lets several behaviors of ASP.NET be determined at the machine or site, including the global value for script timeout. The following is the complete syntax for this tag:

<httpRuntime executionTimeout ="seconds"
maxRequestLength="kbytes"
minFreeThreads="numberOfThreads"
minLocalRequestFreeThreads="numberOfThreads"
appRequestQueueLimit="numberOfRequests"
useFullyQualifiedRedirectUrl="true|false" />

executionTimeout is the maximum time an .aspx page can run before timing out. The default is 90 seconds, extend this value for pages that perform remote calls to a Web service. This attribute corresponds to the Server.ScriptTimeout property.

Change these settings in the .NET configuration file for the Web application - modify machine.config to set these attributes at the machine level, or modify the application's web.config file to set the attributes at the application level.

The machine level .NET config files are usually stored in the folder C:\Windows\Microsoft.NET\Framework\[version]\Config where [version] is the version of the .NET Framework such as v1.1.4322. Restart IIS for the changes to take effect.

Each application's web.config file is part of the project.

If the above procedures do not work, change the setting for the individual Web services timing out. Example for Report Service:

myReport.Timeout = 3000000; //in milliseconds (5 min)
mySiteReport = myReport.getSiteReports(mySite,myReportOptionsArray, True, Token) ;

Note:
Using Visual Studio 2003 or .NET Framework 1.1, a known bug may be encountered that causes the same error message. Microsoft provides a solution for this that can be found by way of the Related Information section below.

Related Information