• IIS Admin Blog

  • How To Configure the CGI Script Timeout Value in IIS 5.0 and 6.0

7th September 2007

How To Configure the CGI Script Timeout Value in IIS 5.0 and 6.0

posted in IIS 6.0 |

You will see a warning on the New Record dialog box informing you that the “Current key inherit’s a record with the same identifier” – this is because the IIS metabase uses inheritance to optimize resource usage. However, specifically setting the same property at the child node over-writes the inherited value, so click OK to create the CGI Timeout value at the ‘CGI Scripts’ virtual directory level. Then right-click on the entry we just created and click Properties. Enter a value 600 on the Value tab and then tick Inheritable on the General tab as shown below. This will ensure that all other scripts in the ‘CGI Scripts’ virtual directory will inherit the default value of 600 seconds unless otherwise specified.

Fig. 11

Finally we are going to use the Command-Line Administration Scripts to set a unique CGI Timeout value at the file level on the file named ‘Search.pl’. The default location in IIS 6.0 for the Administration Scripts is C:\Inetpub\AdminScripts, so starting from a command prompt there we are going to type the following command :

cscript adsutil.vbs set W3SVC/83136308/root/”CGI Scripts”/Search.pl/CGITimeout “1800”

(Note the quotation marks around the virtual directory due to the space in the name)

However, this command fails with the error message shown below. Why is this ? We know that there is definitely a file called ‘Search.pl’ in the virtual directory ‘CGI Scripts’ which is in the Perl Web Site (see Fig.9 above) so why should the command fail ?

Fig. 12

Well the answer is quite simply that the object we are trying to configure the CGITimeout value on doesn’t actually exist in the IIS metabase. Again the reason for this is that in an effort to reduce resource usage the IIS metabase doesn’t contain a reference to every object contained within IIS.

OK, so what do we need to do to configure this value at the file level I hear you ask. The answer is that we need to make use of the IIsWebFile object. The MSDN online documentation states that,

“You can use the IIsWebFile object to set metabase key values that apply to a file in a Web directory for a Web virtual server. Metabase property values set for a specific file will override inherited values that have been set at a higher level in the metabase hierarchy.”


What this means in a nutshell is that we need to create the IIsWebFile object for the ‘Search.pl’ file before we can apply any properties or values to it. In order to do this we need to issue the following command :

cscript adsutil.vbs CREATE W3SVC/83136308/root/”CGI Scripts”/Search.pl IIsWebFile

Once this has been done we can then apply the CGITimeout value on the file itself as shown here.

Fig. 13

So if we look at the properties of the Perl web site using Metabase Explorer we can see that the file ‘Search.pl’ is now listed along with its unique CGITimeout value of 1800 seconds

Fig. 14

So as we have seen, if you are hosting CGI applications on an IIS web server it is possible to exert an extremely fine level of granular control over how those applications are configured provided you know how to access the relevant properties.

The only observation that remains to be made is that Microsoft are apparently going to reinstate the GUI method of controlling CGI applications in IIS 7.0 – a decision which I think is a sensible one and will no doubt please many developers and IIS admins out there. This is mentioned in the IIS 7.0 online documentation here :

IIS 7.0 : Configure CGI Timeout Settings


Pages: 1 2 3

This entry was posted on Friday, September 7th, 2007 at 3:16 pm and is filed under IIS 6.0. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

There is currently one response to “How To Configure the CGI Script Timeout Value in IIS 5.0 and 6.0”

Why not let us know what you think by adding your own comment! Your opinion is as valid as anyone elses, so come on... let us know what you think.

  1. 1 On February 28th, 2012, James Collett said:

    This article was a great help, despite its having been published 4 and a half years ago! The command line method of changing the CGI Timeout on IIS was exactly what we needed, not wanting to instal a downloaded snap-in on a production machine.


Leave a Reply

You must be logged in to post a comment.

  • Calendar

  • March 2018
    M T W T F S S
    « Sep