502 error on new install

Posted by freddiemac on 2015-09-22 07:51

I have installed ActivePerl 32-bit on an IIS 8.5 server. I am trying to get a legacy perl application working. I setup the hander mappings for .pl and .cgi to go to c:\perl\bin\perl.exe "%s" %s as before. But everytime I try to run any perl script through the webserver I get a 502 error: A CGI application returns an HTTP response that is not valid to the server that is running IIS 7.0, IIS 7.5, or IIS 8.0.

I have been able to run the perl script from the command line. Any thoughts?

grahams
ActiveState Staff
Mon, 2015-10-05 15:34

IIS 7+ does not install the components needed to run a Classic ASP site:
http://www.iis.net/learn/application-frameworks/running-classic-asp-appl...

Then, make sure you installed the components you need for the Perl side. You must have a 32-bit ActivePerl if you plan to use PerlEx, PerlIS, or PerlEz; and with 5.16 and higher, you will need to read the installer messages, and manually select these components to be installed. None of them will install by default because the common use-case for them is likely to require a Business Edition license.

Once IIS and Perl are both installed, ensure that the default WebSite is shut down, then start up a cmd.exe window with "Run as Administrator", and run ap-iis-config to set up the mappings (or create the mappings manually). To use a 32-bit Perl, you must create a 32-bit Application pool for the site.

You should be ready to add your site now, but you may still need to re-organize it. Versions of IIS prior to version 7 could use system commands and could access folders that were "above" the IIS root level. Neither is true any longer, and you will have to accommodate. Watch your site for performance issues. You may need to configure advanced IIS options.
http://www.iis.net/learn/application-frameworks/running-classic-asp-appl...

wcook | Fri, 2016-01-08 11:14

#!/perl64/bin/perl
use CGI;
use CGI::Carp qw( fatalsToBrowser );
print "Content-type: text/html\n\n";
print "Test Page";
print "Greetings Earthling!";
print "";

Perl install c:\perl64\
website e:\website\
cgi e:\cgi-bin\ (set to virtual directory)

This is perl 5, version 20, subversion 2 (v5.20.2) built for MSWin32-x64-multi-
thread
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2015, Larry Wall

Binary build 2002 [299195] provided by ActiveState http://www.ActiveState.com
Built Jul 20 2015 13:17:51

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

set handler mapping for Perl-pl, Perl-plx, Perl-cgi (path = cgi-bin)

set ASPI and CGI c:\perl64\bin\perl allowed.

error

HTTP Error 502.2 - Bad Gateway
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are "".

Appreciate any help.....