Previous Next

Thread: Trying to run Perl with IIS 7.0

Last post 04-07-2008 3:56 AM by textor. 9 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (10 items)

Sort Posts:

  • 05-25-2007, 11:00 AM

    • textor
    • Top 500 Contributor
    • Joined on 05-25-2007, 10:34 AM
    • Posts 9

    Trying to run Perl with IIS 7.0

    I have IIS 7.0 on Vista Business and ActivePerl.  However I can't get perl to run.  Can you help?

    When I run a test program I get this

    HTTP Error 502.2 - Bad Gateway
    Description: The specified CGI application did not return a complete set of HTTP headers.
    Error Code: 0x00000000
    Notification: ExecuteRequestHandler
    Module: CgiModule
    Requested URL: http://localhost:80/cgi-bin/hello.pl
    Physical Path: C:\inetpub\wwwroot\cgi-bin\hello.pl

    However I can run the program from the command line

    C:\Users\Bob> C:\inetpub\wwwroot\cgi-bin\hello.pl
    Content-Type:text/html

    <HTML>
    <HEAD><TITLE>Hello World!</TITLE></HEAD>
    <BODY>
    <H4>Hello World!</H4>
    </BODY>
    </HTML>

    In the default Web Site I have a handler set up - The executable is in C:\Perl\bin\perl.exe.  The mapping screen shows this.

    Perl           *.pl       Enabled        File        CgiModule        Local

    The file permissions for hello.pl are for the user  IIS_IUSRS: Read & Execute and Read

    The server log is not much help

    2007-05-25 14:55:46 ::1 GET /cgi-bin/hello.pl - 80 - ::1 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+6.0;+SLCC1;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.04506) 502 2 0

    I tried turning offf the (Norton) firewall but no change.

    I set up the tracing as described in http://www.iis.net/default.aspx?tabid=2&subtabid=25&i=969&p=1 (fantastically clear instructions!)

    IIS Diagnostics Output

    Url: http://localhost:80/cgi-bin/hello.pl
    Site: 1
    App Pool: DefaultAppPool
    Process: 5032
    Authentication: anonymous
    User from token: NT AUTHORITY\IUSR
    Activity ID: {00000000-0000-0000-0400-0080000000FC}
    Failure Reason: STATUS_CODE
    Final Status: 502.2
    Time Taken: 483 msec

    IIS Trace Detail Highlights

    No. EventName Details Time

    IIS Trace Detail

    No. EventName Details Time
    1.
    n
    n
    i
    GENERAL_REQUEST_START SiteId="1", AppPoolId="DefaultAppPool", ConnId="39862976", RawConnId="39862984", RequestURL="http://localhost:80/cgi-bin/hello.pl", RequestVerb="GET" 16:08:53.862
    2.
    n
    n
    i
    GENERAL_GET_URL_METADATA PhysicalPath="C:\inetpub\wwwroot\cgi-bin\hello.pl", AccessPerms="513" 16:08:53.862
    3.
    n
    n
    i
    CGI_START 16:08:53.862
    4.
    n
    n
    i
    GENERAL_CGI_HANDLER 16:08:53.862
    5.
    n
    n
    i
    CGI_LAUNCH CommandLine="C:\Perl\bin\perl.exe", ErrorCode="The operation completed successfully. (0x0)", ProcessId="2500" 16:08:53.924
    6.
    n
    n
    i
    CGI_REQUEST_ENTITY_SENT 16:08:53.924
    7.
    n
    n
    i
    CGI_PREMATURE_TERMINATION Headers="" 16:08:54.330
    8.
    n
    n
    i
    CGI_END 16:08:54.330
    9.
    n
    n
    i
    GENERAL_SEND_CUSTOM_ERROR HttpStatus="502", HttpSubStatus="2", FileNameOrURL="502.htm" 16:08:54.330
    10.
    n
    n
    i
    GENERAL_FLUSH_RESPONSE_START 16:08:54.345
    11.
    n
    n
    i
    GENERAL_FLUSH_RESPONSE_END BytesSent="2537", ErrorCode="The operation completed successfully. (0x0)" 16:08:54.345
    12.
    n
    n
    i
    GENERAL_REQUEST_END BytesSent="2537", BytesReceived="645", HttpStatus="502", HttpSubStatus="2" 16:08:54.345

    Tags:
  • 05-25-2007, 12:41 PM In reply to

    • textor
    • Top 500 Contributor
    • Joined on 05-25-2007, 10:34 AM
    • Posts 9

    Re: Trying to run Perl with IIS 7.0

    Fixed! 

    I changed the handler from Perl.exe to the ISAPI module Perlis.dll 

     Now it works. 

    Bob

  • 04-04-2008, 10:07 PM In reply to

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

    Re: Trying to run Perl with IIS 7.0

    I've tried almost every combination and I keep receiving the same error you mentioned earlier.

    Do you think you can describe to me how you to configure it all?

    Thanks 

  • 04-05-2008, 4:55 AM In reply to

    • textor
    • Top 500 Contributor
    • Joined on 05-25-2007, 10:34 AM
    • Posts 9

    Re: Trying to run Perl with IIS 7.0

  • 04-05-2008, 10:52 PM In reply to

    Re: Trying to run Perl with IIS 7.0

    http://forums.iis.net/t/1148010.aspx

    Did you add the mapping?

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield

    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
  • 04-05-2008, 11:51 PM In reply to

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

    Re: Trying to run Perl with IIS 7.0

     Thanks for your reply Bob.

    Actually I had already read that post and tried every single configuration without success =(

    I will keep looking for the solution 

  • 04-06-2008, 12:01 AM In reply to

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

    Re: Trying to run Perl with IIS 7.0

    Thanks Steve, I have already added the mappings but that's not the error as I can run scripts.

    The problem is related to some headers.

    The error is 502.2, currently I'm doing more tests trying to understand the logs from the failed request, which unfortunately are kind of cryptic

  • 04-06-2008, 12:20 AM In reply to

    Re: Trying to run Perl with IIS 7.0

    Right 502.2 is ""The specified CGI application did not return a complete set of HTTP headers.".

    I'm not sure what else to suggest.   There was another post that shows step by step getting PERL working.  I'll see if I can find it.

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield

    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
  • 04-06-2008, 12:36 AM In reply to

    Re: Trying to run Perl with IIS 7.0

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield

    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
  • 04-07-2008, 3:56 AM In reply to

    • textor
    • Top 500 Contributor
    • Joined on 05-25-2007, 10:34 AM
    • Posts 9

    Re: Trying to run Perl with IIS 7.0

    We had to change our perl code to output an extra header

       if ($ENV{OS} =~/Windows/)
       {
        print "HTTP/1.0 200 OK\n";
       }
       print "Content-type: text/html\n\n";        

    before the regular MIME headers.  This is on IIS6.  But I don't recall having to do that with IIS7.

    That would be a long shot though.

     Bob 

     

Page 1 of 1 (10 items)
Page view counter