Greyware Automation Products, Inc.
Greyware Automation Products, Inc.   
     Home    Products    Store    Downloads    Customer Service    Site Search    
Log in  or   Create an account now -- FREE!        
Kb > Knowledgebase Article KB2005.0502

KB2005.502
Problem: CGI programs are installed but not responding on Windows using IIS

This article applies to all CGI applications.

Last Updated: 11 June 2015

Problem

    The CGI program is installed on a Windows web site, but the CGI application doesn't appear to be responding even though IIS is running. The browser may offer to download the CGI program file instead of executing it.

Details

    CGI applications require that CGI scripting be properly enabled on the web server. Versions of IIS starting with 6.0 on Windows Server 2003 have new restrictions on applications that require additional configuration steps to enable CGI programs. By default, any new CGI program must have an Application Extension Mapping defined for its executable in the website properties, AND it must be added to the Web Service Extension Restriction List (WSERL) before it will be executed by IIS.

Solution

    First, be sure you have followed all of the basic installation instructions for the application correctly (i.e. copied the CGI executable file to your CGI scripts folder, given it proper folder access permissions, given it correct IIS execute permissions to run as a script, and granted any necessary rights for the web user (IUSR) to the system TEMP folder).

     

      Configuring CGI on IIS 6 (Windows Server 2003)

      You will need to create an Application Extension Mapping for the CGI program executable in your website properties. To do this, open IIS Manager and view the Properties for your website. Click the the Home Directory tab and click the Configuration button in the Application Settings section to bring up the Application Configuration dialog. Click the Add button to add the complete local path to the CGI program executable file. Use Browse to locate it if necessary. Note: You cannot use a virtual directory in your path, it must be an actual path (i.e. C:\Inetpub\cgi-bin). Be sure the Allow all verbs radio button is selected and apply your changes.

      Finally, you must add the CGI program executable to the Web Service Extension Restriction list (WSERL). You can do this in one of two ways:

      • Use the Web Service Extension section of the IIS Manager MMC to allow all CGI programs to run, regardless of whether they are entered in the WSERL. Note this option is easier to implement but somewhat less secure than the other method.
        1. Open the IIS Manager MMC applet
        2. Choose the Web Service Extensions section and set the "Allow All Unknown CGI Extensions" option to "Allow."

      • Use the IIS IisExt.vb command-line script to add the executable to the WSERL.
        1. Open a Command Promt window and change to the Sysvol\System32 folder (the default is Windows\System32)
        2. Type the following:

          iisext /EnFile ScriptPath\ExecutableName
          where ScriptPath is the complete path to your Scripts folder, i.e. C:\Inetpub\cgi-bin and ExecutableName is the filename of the executable, i.e. dompass.exe Thus, in our example, the complete line for enabling dompass.exe would be:

            iisext /EnFile C:\Inetpub\cgi-bin\dompass.exe

          You should receive the following response:

          Connecting to server ...Done.
          Enabling extension file complete.

      See Microsoft Knowledgebase article 328360 for more information on enabling CGI on IIS 6.

       

      Configuring CGI on IIS 7x (Windows Server 2008/2008 R2)

      These instructions show a sample configuration for Domain Password. Substitute the correct .EXE program name and path if you are using a different CGI program.

      1. Use Server Manager's "Add Role Services" option to add the CGI role service to the Web Server role.

      2. Create a separate folder for your CGI programs in your website's main file folder (i.e. C:\inetpub\wwwroot\cgi-bin\).

      3. Copy your CGI application and any supporting files into the new cgi-bin folder.

      4. Use IIS Manager to view the folder list in your website. Right-click the new cgi-bin folder you created and choose "Convert to Application" and accept the default settings.

      5. Modify security on the filesystem to grant the IUSR user "Modify" permissions to both the cgi-bin folder and the system TEMP folder (i.e. C:\Windows\Temp). If you don't know the location of the system TEMP folder, check your system's environment variables.

      6. Back in IIS Manager, highlight the Server machine name in the left-hand column (note this is a number of levels up from the website item) and choose the "ISAPI and CGI Restrictions" icon. Click the "Add..." link to define a new extension, entering the full path to the CGI Program and a friendly name for the extension, i.e.
          ISAPI or CGI path: C:\Inetpub\cgi-bin\dompass.exe
          Description: Domain Password
        Don't forget to click the "Allow" link to enable the extension.

      7. Next, with the "cgi-bin" folder highlighted in the left-hand pane, click the "Handler Mappings" icon and then the "Add Module Mapping" link to add a new mapping with these values:
          Request path: dompass.exe
          Module: CgiModule Executable:C:\inetpub\wwwroot\cgi-bin\dompass.exe
          Name: Domain Password

My Account  |   Contact Us  |   Privacy Policy  |   Printer-Friendly Version
 
Copyright © 1995-2023 Greyware Automation Products, Inc.  All Rights Reserved
All Trademarks mentioned are the properties of their respective owners.