Previous Next

Thread: HTTP Error 502.2 - Bad Gateway.... Anybody has the solution

Last post 05-15-2008 1:37 AM by qbernard. 15 replies.

Average Rating Rate It (5)

RSS

Page 1 of 2 (16 items) 1 2 Next >

Sort Posts:

  • 11-29-2007, 8:43 AM

    • Badriprasad
    • Not Ranked
    • Joined on 11-29-2007, 1:20 PM
    • Posts 5
    • Badriprasad

    HTTP Error 502.2 - Bad Gateway.... Anybody has the solution

    Hi everybody,

    i am on Windows Vista Buisiness. Trying to  run perl script using IIS 7.0.  I have  installed and configured perl  and IIS too. Added Script mapping for *.cgi and *.pl also.

    But when i m trying to run my script it's giving the following error.

    pls help me if anyone has the solution.

    Thanx in advance.

    The error is as follows..

    HTTP Error 502.2 - Bad Gateway

    Description: The specified CGI application did not return a complete set of HTTP headers.

    Error Code: 0x00000103

    Notification: ExecuteRequestHandler

    Module: CgiModule

    Requested URL: http://localhost:80/cgi-bin/script1_oriya.pl

    Physical Path: G:\webscripts\script1_oriya.pl

    Logon User: Anonymous

    Logon Method: Anonymous

    Handler: CGI Script Map

    Most likely causes:

    • The CGI process was shut down or terminated unexpectedly before it finished processing the request.
    • The CGI process has a flaw and does not return a complete set of HTTP headers.

    What you can try:

    • Check the event logs on the system to see whether the CGI process is shutting down unexpectedly.
    • Troubleshoot the CGI application to determine why it is not sending a complete set of HTTP headers.

     

  • 11-29-2007, 8:55 AM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 988
    • anilr

    Re: HTTP Error 502.2 - Bad Gateway.... Anybody has the solution

    Can you cut-n-paste the relevant handler entry from your config file?  Also, if possible, if you could try the same on vista sp1 beta or ws08 rc - the error message for this error now includes the exact error returned by the cgi app, which can help in troubleshooting the problem.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 11-30-2007, 3:35 AM In reply to

    • Badriprasad
    • Not Ranked
    • Joined on 11-29-2007, 1:20 PM
    • Posts 5
    • Badriprasad

    Re: HTTP Error 502.2 - Bad Gateway.... Anybody has the solution

    hi anil, 

    thanx 4 d response. i hv pasted below the content of web.config file which is present inside the virtual directory. hope i have provided u the right thing. 

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <directoryBrowse enabled="false" />
            <handlers accessPolicy="Script, Execute, Read">
                <add name="CGI Script Map" path="*.pl" verb="*" modules="CgiModule" scriptProcessor="c:\Perl\bin\perl.exe &quot;%s&quot; %s" resourceType="File" />
                <add name="Perl Script Map" path="*.cgi" verb="*" modules="CgiModule" scriptProcessor="c:\Perl\bin\perl.exe &quot;%s&quot; %s" resourceType="File" />
            </handlers>
        </system.webServer>
    </configuration>

     Thanx in advance

    Badri

  • 12-03-2007, 2:21 AM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 988
    • anilr

    Re: HTTP Error 502.2 - Bad Gateway.... Anybody has the solution

    The script-map looks ok - can you try from the command line to cd to the site-root and run the perl-script with c:\Perl\bin\perl.exe "path to perl-script" arguments - and see what output you get in that case - also maybe remove the &quot; surrounding the script-name in the handler entry - also, as I said, vista sp1/ws08 rc has extra information in the detailed error for this event which will let you see what output IIS actually got from this script.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 04-04-2008, 10:20 PM In reply to

    • vivesfm
    • Not Ranked
    • Joined on 04-05-2008, 1:57 AM
    • Posts 6
    • vivesfm

    Re: HTTP Error 502.2 - Bad Gateway.... Anybody has the solution

    Hi Anilr, I've been following a lot of threads similar to this one but still can't resolve my problem.

    I keep receiving the Error 502.2 and I can't figure out why nor I know how to debug it.

    Do you have any suggestions?

    Below is my config just in case you want to take a look at it. 

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <handlers accessPolicy="Script, Read">
                <add name="CGI Script Map" path="*.pl" verb="*" modules="CgiModule" scriptProcessor="c:\Perl\bin\perl.exe &quot;%s&quot; %s" resourceType="File" />
                <add name="Perl Script Map" path="*.cgi" verb="*" modules="CgiModule" scriptProcessor="c:\Perl\bin\perl.exe &quot;%s&quot; %s" resourceType="File" />
            </handlers>
        </system.webServer>
    </configuration>
     

  • 04-07-2008, 1:15 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 988
    • anilr

    Re: HTTP Error 502.2 - Bad Gateway.... Anybody has the solution

    What is the text of the error response when hitting the page from localhost?  vista sp1/ws08 rtm includes any error response from the CGI in the error response.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 04-07-2008, 10:53 PM In reply to

    • vivesfm
    • Not Ranked
    • Joined on 04-05-2008, 1:57 AM
    • Posts 6
    • vivesfm

    Re: HTTP Error 502.2 - Bad Gateway.... Anybody has the solution

    Here's what the log says:

    IIS Diagnostics Output

    Url: http://localhost:80/cgi-bin/swish.cgi?query=test&submit=Search%21&metaname=swishdefault&sort=swishrank
    Site: 1
    App Pool: DefaultAppPool
    Process: 3836
    Authentication: anonymous
    User from token: NT AUTHORITY\IUSR
    Activity ID: {00000000-0000-0000-1100-0080000000FC}
    Failure Reason: STATUS_CODE
    Final Status: 502.2
    Time Taken: 30014 msec

    IIS Trace Detail Highlights

    No.
    EventName Details Time
    69.
    n
    n
    r
    MODULE_SET_RESPONSE_ERROR_STATUS
    Warning
    ModuleName="CgiModule", Notification="EXECUTE_REQUEST_HANDLER", HttpStatus="502", HttpReason="Bad Gateway", HttpSubStatus="2", ErrorCode="No more data is available. (0x103)", ConfigExceptionInfo="" 02:44:44.780

    IIS Trace Detail

    No.
    EventName Details Time
    1.
    n
    n
    i
    GENERAL_REQUEST_START SiteId="1", AppPoolId="DefaultAppPool", ConnId="14969712", RawConnId="14969720", RequestURL="http://localhost:80/cgi-bin/swish.cgi?query=test&submit=Search%21&metaname=swishdefault&sort=swishrank", RequestVerb="GET" 02:44:14.766
    2.
    n
    n
    i
    FILTER_START FilterName="C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_filter.dll" 02:44:14.766
    3.
    n
    n
    i
    FILTER_PREPROC_HEADERS_START
    02:44:14.766
    4.
    n
    n
    i
    FILTER_SET_REQ_HEADER HeaderName="AspFilterSessionId:", HeaderValue="" 02:44:14.766
    5.
    n
    n
    i
    FILTER_PREPROC_HEADERS_END
    02:44:14.766
    6.
    n
    n
    i
    FILTER_END
    02:44:14.766
    7.
    n
    n
    i
    URL_CACHE_ACCESS_START RequestURL="/cgi-bin/swish.cgi?query=test&submit=Search%21&metaname=swishdefault&sort=swishrank" 02:44:14.766
    8.
    n
    n
    i
    URL_CACHE_ACCESS_END PhysicalPath="", URLInfoFromCache="true", URLInfoAddedToCache="false", ErrorCode="The operation completed successfully. (0x0)" 02:44:14.766
    9.
    n
    n
    i
    GENERAL_GET_URL_METADATA PhysicalPath="C:\SWISH-E\cgi-bin\swish.cgi", AccessPerms="513" 02:44:14.766
    10.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="IpRestrictionModule", Notification="BEGIN_REQUEST", fIsPostNotification="false", fIsCompletion="false" 02:44:14.766
    11.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="IpRestrictionModule", Notification="BEGIN_REQUEST", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:14.766
    12.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="RequestFilteringModule", Notification="BEGIN_REQUEST", fIsPostNotification="false", fIsCompletion="false" 02:44:14.766
    13.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="RequestFilteringModule", Notification="BEGIN_REQUEST", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:14.766
    14.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="FailedRequestsTracingModule", Notification="BEGIN_REQUEST", fIsPostNotification="false", fIsCompletion="false" 02:44:14.766
    15.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="FailedRequestsTracingModule", Notification="BEGIN_REQUEST", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:14.766
    16.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="RequestMonitorModule", Notification="BEGIN_REQUEST", fIsPostNotification="false", fIsCompletion="false" 02:44:14.766
    17.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="RequestMonitorModule", Notification="BEGIN_REQUEST", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:14.766
    18.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="ConfigurationValidationModule", Notification="BEGIN_REQUEST", fIsPostNotification="false", fIsCompletion="false" 02:44:14.766
    19.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="ConfigurationValidationModule", Notification="BEGIN_REQUEST", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:14.766
    20.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="CertificateMappingAuthenticationModule", Notification="AUTHENTICATE_REQUEST", fIsPostNotification="false", fIsCompletion="false" 02:44:14.766
    21.
    n
    n
    i
    AUTH_START AuthTypeSupported="MapCliCert" 02:44:14.766
    22.
    n
    n
    i
    AUTH_END
    02:44:14.766
    23.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="CertificateMappingAuthenticationModule", Notification="AUTHENTICATE_REQUEST", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:14.766
    24.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="IsapiFilterModule", Notification="AUTHENTICATE_REQUEST", fIsPostNotification="false", fIsCompletion="false" 02:44:14.766
    25.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="IsapiFilterModule", Notification="AUTHENTICATE_REQUEST", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:14.766
    26.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="BasicAuthenticationModule", Notification="AUTHENTICATE_REQUEST", fIsPostNotification="false", fIsCompletion="false" 02:44:14.766
    27.
    n
    n
    i
    AUTH_START AuthTypeSupported="Basic" 02:44:14.766
    28.
    n
    n
    i
    AUTH_END
    02:44:14.766
    29.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="BasicAuthenticationModule", Notification="AUTHENTICATE_REQUEST", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:14.766
    30.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="DigestAuthenticationModule", Notification="AUTHENTICATE_REQUEST", fIsPostNotification="false", fIsCompletion="false" 02:44:14.766
    31.
    n
    n
    i
    AUTH_START AuthTypeSupported="Digest" 02:44:14.766
    32.
    n
    n
    i
    AUTH_END
    02:44:14.766
    33.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="DigestAuthenticationModule", Notification="AUTHENTICATE_REQUEST", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:14.766
    34.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="WindowsAuthenticationModule", Notification="AUTHENTICATE_REQUEST", fIsPostNotification="false", fIsCompletion="false" 02:44:14.766
    35.
    n
    n
    i
    AUTH_START AuthTypeSupported="NT" 02:44:14.766
    36.
    n
    n
    i
    AUTH_END
    02:44:14.766
    37.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="WindowsAuthenticationModule", Notification="AUTHENTICATE_REQUEST", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:14.766
    38.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="IISCertificateMappingAuthenticationModule", Notification="AUTHENTICATE_REQUEST", fIsPostNotification="false", fIsCompletion="false" 02:44:14.766
    39.
    n
    n
    i
    AUTH_START AuthTypeSupported="MapCliCert" 02:44:14.766
    40.
    n
    n
    i
    AUTH_END
    02:44:14.766
    41.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="IISCertificateMappingAuthenticationModule", Notification="AUTHENTICATE_REQUEST", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:14.766
    42.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="AnonymousAuthenticationModule", Notification="AUTHENTICATE_REQUEST", fIsPostNotification="false", fIsCompletion="false" 02:44:14.766
    43.
    n
    n
    i
    AUTH_START AuthTypeSupported="Anonymous" 02:44:14.766
    44.
    n
    n
    i
    AUTH_REQUEST_AUTH_TYPE RequestAuthType="Anonymous" 02:44:14.766
    45.
    n
    n
    i
    AUTH_SUCCEEDED AuthType="Anonymous", NTLMUsed="false", RemoteUserName="", AuthUserName="", TokenImpersonationLevel="ImpersonationImpersonate" 02:44:14.766
    46.
    n
    n
    i
    AUTH_END
    02:44:14.766
    47.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="AnonymousAuthenticationModule", Notification="AUTHENTICATE_REQUEST", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:14.766
    48.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="IsapiFilterModule", Notification="MAP_PATH", fIsPostNotification="false", fIsCompletion="false" 02:44:14.766
    49.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="IsapiFilterModule", Notification="MAP_PATH", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:14.766
    50.
    n
    n
    i
    FILE_CACHE_ACCESS_START FileName="C:\SWISH-E\cgi-bin\swish.cgi", UserName="IUSR", DomainName="NT AUTHORITY" 02:44:14.766
    51.
    n
    n
    i
    FILE_CACHE_ACCESS_END Successful="true", FileFromCache="false", FileAddedToCache="true", FileDirmoned="true", LastModCheckErrorIgnored="true", ErrorCode="The operation completed successfully. (0x0)" 02:44:14.766
    52.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="UrlAuthorizationModule", Notification="AUTHORIZE_REQUEST", fIsPostNotification="false", fIsCompletion="false" 02:44:14.766
    53.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="UrlAuthorizationModule", Notification="AUTHORIZE_REQUEST", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:14.766
    54.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="IsapiFilterModule", Notification="AUTHORIZE_REQUEST", fIsPostNotification="false", fIsCompletion="false" 02:44:14.766
    55.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="IsapiFilterModule", Notification="AUTHORIZE_REQUEST", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:14.766
    56.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="HttpCacheModule", Notification="RESOLVE_REQUEST_CACHE", fIsPostNotification="false", fIsCompletion="false" 02:44:14.766
    57.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="HttpCacheModule", Notification="RESOLVE_REQUEST_CACHE", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:14.766
    58.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="StaticCompressionModule", Notification="MAP_REQUEST_HANDLER", fIsPostNotification="false", fIsCompletion="false" 02:44:14.766
    59.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="StaticCompressionModule", Notification="MAP_REQUEST_HANDLER", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:14.766
    60.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="HttpRedirectionModule", Notification="MAP_REQUEST_HANDLER", fIsPostNotification="false", fIsCompletion="false" 02:44:14.766
    61.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="HttpRedirectionModule", Notification="MAP_REQUEST_HANDLER", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:14.766
    62.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="CgiModule", Notification="EXECUTE_REQUEST_HANDLER", fIsPostNotification="false", fIsCompletion="false" 02:44:14.766
    63.
    n
    n
    i
    CGI_START
    02:44:14.766
    64.
    n
    n
    i
    GENERAL_CGI_HANDLER
    02:44:14.766
    65.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="IsapiFilterModule", Notification="MAP_PATH", fIsPostNotification="false", fIsCompletion="false" 02:44:14.766
    66.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="IsapiFilterModule", Notification="MAP_PATH", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:14.766
    67.
    n
    n
    i
    CGI_LAUNCH CommandLine="C:\Perl\bin\perl.exe "C:\SWISH-E\cgi-bin\swish.cgi" ", ErrorCode="The operation completed successfully. (0x0)", ProcessId="3888" 02:44:14.766
    68.
    n
    n
    i
    CGI_REQUEST_ENTITY_SENT
    02:44:14.766
    69.
    n
    n
    r
    MODULE_SET_RESPONSE_ERROR_STATUS
    Warning
    ModuleName="CgiModule", Notification="EXECUTE_REQUEST_HANDLER", HttpStatus="502", HttpReason="Bad Gateway", HttpSubStatus="2", ErrorCode="No more data is available. (0x103)", ConfigExceptionInfo="" 02:44:44.780
    70.
    n
    n
    i
    CGI_PREMATURE_TERMINATION Headers="Use of uninitialized value $fd in pattern match (m//) at C:/Perl/lib/IO/Handle.pm line 352. Use of uninitialized value $fd in concatenation (.) or string at C:/Perl/lib/IO/Handle.pm line 362. C:\SWISH-E\cgi-bin\swish.cgi aborted: open2: Can't call method "close" on an undefined value at C:/Perl/lib/IPC/Open3.pm line 365. " 02:44:44.780
    71.
    n
    n
    i
    CGI_END
    02:44:44.780
    72.
    n
    n
    —
    NOTIFY_MODULE_COMPLETION ModuleName="CgiModule", Notification="EXECUTE_REQUEST_HANDLER", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:44.780
    73.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="StaticCompressionModule", Notification="RELEASE_REQUEST_STATE", fIsPostNotification="false", fIsCompletion="false" 02:44:44.780
    74.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="StaticCompressionModule", Notification="RELEASE_REQUEST_STATE", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:44.780
    75.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="HttpCacheModule", Notification="UPDATE_REQUEST_CACHE", fIsPostNotification="false", fIsCompletion="false" 02:44:44.780
    76.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="HttpCacheModule", Notification="UPDATE_REQUEST_CACHE", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:44.780
    77.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="CustomLoggingModule", Notification="LOG_REQUEST", fIsPostNotification="false", fIsCompletion="false" 02:44:44.780
    78.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="CustomLoggingModule", Notification="LOG_REQUEST", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:44.780
    79.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="RequestMonitorModule", Notification="END_REQUEST", fIsPostNotification="false", fIsCompletion="false" 02:44:44.780
    80.
    n
    n
    —
    NOTIFY_MODULE_END ModuleName="RequestMonitorModule", Notification="END_REQUEST", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE" 02:44:44.780
    81.
    n
    n
    —
    NOTIFY_MODULE_START ModuleName="HttpLoggingModule", Notification="SEND_RESPONSE", fIsPostNotification="false", fIsCompletion="false&q