Overview:
Occasionally requests (for example, long running workflows or print jobs) can exceed 60 seconds to complete. When this happens, the viewer will show a timeout error. This article will show you how to increase the timeout as one method to avoid these errors.
Solution:
The ideal solution for this issue is to determine what request is taking a long time and find a different way to achieve the same goal. If the request is a workflow activity, the same process may be possible using fewer operations, different hardware, asynchronous calls, or pre-rendered data. If it's an Essentials Site initialization, then removing problematic layers and services or switching to a layer catalog may resolve the issue.
As a temporary measure, we can increase the timeout for requests to allow the long-running request to complete before the viewer gives up. There are two places that control a request timeout: in the REST application configuration, and in the viewer code itself.
To update the timeout for the REST application, perform the following steps:
Occasionally requests (for example, long running workflows or print jobs) can exceed 60 seconds to complete. When this happens, the viewer will show a timeout error. This article will show you how to increase the timeout as one method to avoid these errors.
Solution:
The ideal solution for this issue is to determine what request is taking a long time and find a different way to achieve the same goal. If the request is a workflow activity, the same process may be possible using fewer operations, different hardware, asynchronous calls, or pre-rendered data. If it's an Essentials Site initialization, then removing problematic layers and services or switching to a layer catalog may resolve the issue.
As a temporary measure, we can increase the timeout for requests to allow the long-running request to complete before the viewer gives up. There are two places that control a request timeout: in the REST application configuration, and in the viewer code itself.
To update the timeout for the REST application, perform the following steps:
- Back up your REST web.config file (located here by default: C:\Program Files (x86)\Latitude Geographics\Geocortex Essentials\Default\REST Elements\REST\Web.config )
- In an editor with Administrator privileges, edit your REST Web.config file, and add the following parameter to the httpRuntime element, which is a child of the system.web element:
executionTimeout="180"So the whole element should look like this:
<httpRuntime maxRequestLength="20480" requestValidationMode="2.0" enableVersionHeader="false" executionTimeout="180" />The value for executionTimeout is in seconds. 180 seconds is three minutes, which should be sufficient time to service a web request. When not set, the default value is 110 seconds.
- Save the web.config file. This should recycle the app pool, but if in doubt, you may also restart the IIS service to apply this setting.
- Navigate to the viewer folder in the wwwroot folder (default location: C:\inetpub\wwwroot\Html5Viewer )
- Make a backup of the index.html file
- Edit the index.html file
- Look for this line towards the bottom of the file:
new geocortex.essentialsHtmlViewer.ViewerLoader().loadAndInitialize();and comment it out as follows:
// new geocortex.essentialsHtmlViewer.ViewerLoader().loadAndInitialize();Directly underneath the comment, add the following:
new geocortex.essentialsHtmlViewer.ViewerLoader().loadAndInitialize({ onSiteInitialized: function(app, loader) { geocortex.config.io.timeout = 180 * 1000; // three minutes } });and set the geocortex.config.io.timeout to an appropriate value. We recommend that the two timeout values be matched to avoid one timeout lapsing before the other.
NOTE: Editing the viewer's index.html is a global change, affecting all web requests made by the viewer. We recommend using this setting only until the rest of your architecture and configuration can be reviewed and updated to ensure requests can be loaded in a timely fashion.
Comments
0 comments
Article is closed for comments.