Microsoft KB Archive/268364

= PRB: &quot;Script Time Out&quot; Error in Active Server Pages (ASP) =

Article ID: 268364

Article Last Modified on 7/15/2004

-

APPLIES TO


 * Microsoft Active Server Pages 4.0
 * Microsoft Internet Information Server 4.0
 * Microsoft Internet Information Services 5.0

-



This article was previously published under Q268364



SYMPTOMS
When you attempt to run an Active Server Pages (ASP) page, you may receive the following error message:

Error Type:

Active Server Pages, ASP 0113 (0x80004005) The maximum amount of time for a script to execute was exceeded. You can change this limit by specifying a new value for the property Server.ScriptTimeout or by changing the value in the IIS administration tools.



CAUSE
The ScriptTimeout property specifies the maximum amount of time that a script can run before it is terminated. The error is generated when the processing time of the script exceeds the maximum value that has been designated for the ScriptTimeout property.



RESOLUTION
There are three ways to resolve this problem:  You can increase the time that is allowed to process ASP scripts for a particular Web site. To do this, change the metabase value in Internet Information Server (IIS):  Open Internet Services Manager. Expand the tree and right-click Default Web Site (or the site that has the problem). Click Properties. Click the Home Directory tab. Under Application Settings, click Configuration.</li> Click the App Options tab.</li> Increase the ASP Script Timeout value to a number high enough to prevent script timeouts.</li></ol>

-or-

</li> You can increase the time allowed to process ASP scripts for all Web sites. To do this, change the metabase value in IIS: <ol> Open Internet Services Manager.</li> Right-click the name of your computer.</li> Click Properties.</li> In Master Properties, select WWW Service, and then click Edit.</li> Click the Home Directory tab.</li> Under Application Settings, click Configuration.</li> Click the App Options tab.</li> Increase the ASP Script Timeout value to a number high enough to prevent script timeouts.</li></ol>

-or-

</li>  You can use the Server.ScriptTimeOut property to programmatically increase the ScriptTimeOut property value at the page level in ASP. For example, if you want 3 minutes to pass before script processing times out, add the following line to the ASP page: Server.ScriptTimeout = 180 NOTE: When you set the script timeout at the page level, you cannot set it to less than the metabase value in IIS (90 seconds by default). However, you can set the script timeout value higher than the metabase value. For example, if you don't change the metabase default, and you code the following: Server.ScriptTimeout = 20 the ScriptTimeOut value is 90. If you code the following: Server.ScriptTimeout = 120 the ScriptTimeOut value is 120. </li></ul>

<div class="moreinformation_section">

Steps to Reproduce Behavior
<ol> Open Internet Services Manager.</li> Expand the tree and right-click Default Web Site (or the site on which you want to reproduce this problem).</li> Click Properties.</li> Click the Home Directory tab.</li> <li>Under Application Settings, click Configuration.</li> <li>Click the App Options tab.</li> <li>Set the ASP Script Timeout to 5.</li> <li> Create a new ASP page with the following code in the Head section: <% EndTime = Now + (10 / (24 * 60* 60)) '10 seconds Do While Now < EndTime Response.Write &quot;. &quot; Loop %>                   </li> <li>View the ASP page in the browser.</li></ol>

NOTE: An increase in timeout value can have a negative effect on server performance. You should design scripts that run within the default timeout settings. For example, an increase in script timeout value can keep IIS threads occupied and reduce the number of users that the server can serve.

<div class="references_section">