问题
I've got a project written in classic asp, and a particular form's submit is handled by a Perl script.
I'm going to do an enhancement for this project. I installed the latest version of ActivePerl for Windows 32 bits.
I looked at the production environment and saw that in the IIS 7.5, there is an entry on "Handler Mappings" for *.pl
to be handled by C:\Perl\bin\PerlEx30.dll
. So I did the same thing on development environment. (please note that there is no mapping for "*.cgi" on the Prod. environment)
Now when I'm trying to submit the form which its action is MyScript.pl
, I get the following error:
HTTP Error 405.0 - Method Not Allowed
The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.
Maybe worth saying that, I'm on 64 bits environment, I tried ActivePerl for Windows 64 bits as well (I mapped *.pl
to perl514.dll
) but still getting the same error!
回答1:
Your workaround was to use 32-bit version of perl. If you want to use the 64-bit version, this worked for me on IIS 8.5 Windows 2012 R2:
- Add Module Mapping to your site:
- Request path: *.pl
- Module: CgiModule
- Executable: C:\Perl64\bin\perl.exe "%s" %s
- Name: Perl CGI
You can test it by creating the following 'hello world' page:
use strict;
use CGI;
my $page = new CGI;
my $msg = "Hello from ActivePerl CGI!";
print $page->header( "text/html" ),$page->start_html( $msg );
print $page->h2($msg);
print $page->end_html;
Name it something like test.pl, drop it into your webroot directory and browse to it to test.
回答2:
The application pool was set so "Enable 32-Bit Applications = false
", I change it to true, and it fixes the issue.
回答3:
You haven't said whether or not you've gotten ANY Perl to work yet (even a "hello world"), or if the problem is this one particular script (perhaps just on this one particular server).
ANYWAY -
I doubt your Perl install is the problem.
You definitely need to do more troubleshooting.
I'd start with verifying whether a simple, one-line "hello world" will work.
Next, I'd "divide and conquer" to determine exactly WHERE the problem is. I'm guessing it's very probably somewhere in "MyScript.pl". I'm also guessing that it should be fairly easy to track down.
These links might help give you more clues as to exactly what you might look for as you "divide and conquer" (AFTER you've verified that Perl itself can be invoked from your IIS):
What causes an HTTP 405 "invalid method (HTTP verb)" error when POSTing a form to PHP on IIS?
http://www.tech-faq.com/troubleshooting-iis.html
PS: I'm guessing the problem might be as simple as a missing, or inappropriate, URL in "MyScript.pl"!
PPS: At the risk of repeating myself - please verify "helo_world.pl" first. If it doesn't work, please post the complete "hello_world" script and the complete error message(s).
来源:https://stackoverflow.com/questions/8966866/handling-perl-iis-7-5