Gateway Error When Run CGI Application Connecting to Database (151825)



The information in this article applies to:

  • Microsoft Internet Information Server 1.0
  • Microsoft Internet Information Server 2.0
  • Microsoft Internet Information Server 3.0
  • Microsoft Internet Information Server 4.0

This article was previously published under Q151825
We strongly recommend that all users upgrade to Microsoft Internet Information Services (IIS) version 6.0 running on Microsoft Windows Server 2003. IIS 6.0 significantly increases Web infrastructure security. For more information about IIS security-related topics, visit the following Microsoft Web site:

SYMPTOMS

When you use a CGI application that accesses a SQL Server or other database, Internet Information Server (IIS) may return the following error:
502 Gateway error
However, IIS can also return no information, and the Web browser will appear to stop responding.

CAUSE

When you access a data source with IIS, a System DSN must be used. This applies for CGI applications and Internet Database Connector(IDC) files.

RESOLUTION

To set up a System DSN:

  1. In Control Panel, click the ODBC icon.
  2. In the Data Sources dialog box, click the System DSN button. NOTE: This step is important because IIS only works with System DSN.
  3. In the System DSN dialog box, click the Add button to display the Add Data Source dialog box.
  4. In the Add Data Source dialog box, select the driver for the data source you are connecting to, and click OK.
  5. Enter the data source name and the location of the database as needed (depending on which type of database you plan to access).
  6. Click OK. NOTE: The System Data Sources dialog box is
    displayed and displays the name of the data source you created. Click Close.
  7. The Data Sources dialog box is displayed. Click Close.

Modification Type:MinorLast Reviewed:6/22/2005
Keywords:kbenv KB151825