Search code examples
perliisiis-7.5fastcgi

How to configure Perl/FCGI (FastCGI) with IIS 7.5?


I'm trying to get Perl/FastCGI (FCGI) running with IIS 7.5. The version of C:\Windows\System32\inetsrv\iisfcgi.dll is 7.5.7601.17514. Here's my web.config and my Perl script:

D:\MiLu\Dev :: more /t1 web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
 <system.webServer>
  <directoryBrowse enabled="true" />
  <handlers>
   <add name="FCGI" path="*.pl" verb="*"
    modules="FastCgiModule"
    scriptProcessor="C:\Opt\Cygwin\bin\perl.exe"
    resourceType="Unspecified" requireAccess="Script" />
  </handlers>
 </system.webServer>
</configuration>

D:\MiLu\Dev :: more /t4 Perl\fcgi\count.pl
use strict;
use warnings;
use FCGI;

my $count = 0;
my $request = FCGI::Request();

while ( $request->Accept >= 0 ) {
    print "Content-type: text/html\r\n\r\n", ++$count;
}

All I'm getting is a 500 with a generic error page from IIS stating "The FastCGI process exited unexpectedly" and listing possible error causes.

The script runs fine from the command line, printing its three lines and then exiting immediately, indicating that script and module installation are alright. (I copied it from the FCGI manual, by the way, so it should be okay.)

D:\MiLu\Dev :: C:\Opt\Cygwin\bin\perl.exe Perl\fcgi\count.pl
Content-type: text/html

1

There is an FCGI::IIS module, however, it appears to have worked only for IIS 5.1 and 6.0.

The fact that there is a dedicated FCGI module for IIS suggests that IIS 5.1 and 6.0 provided their own non-standard FCGI implementation. So if this were true, what about IIS 7.5 then? Quite a lot of uncertainties.

The author of FCGI::IIS seems to have tried to make his module work with IIS 7.0 (Getting Perl working on IIS7 with FastCGI - 2007), but given up.

Where can I find something more concrete as to what the error is? Is there a log file? What should I be looking for in the Windows event viewer (eventvwr)?

Is there some magic incantation for IIS that I'm missing?

There's not much information out there on this combination. But it might work, in the end. There is a FastCGI Application configuration reference page here, and someone has got Catalyst to work with FastCGI on IIS 7.0 (Catalyst+IIS 7.0 on MS Windows 2008/Vista).


Solution

  • I've not done this for a while, and never with Cygwin. In order to test this could you please download and install the latest active state perl for your architecture and try installing/configuring as below:

    http://legacy.websitepanel.net/kb/installing-and-running-active-perl-runtime-as-isapi-on-microsoft-iis-7.0

    Another reference:

    http://blogs.iis.net/wadeh/archive/2009/04/13/running-perl-on-iis-7.aspx

    Good luck.