为什么我的IIS上的Perl CGI程序出现"Bad Gateway"错误?

Eyl*_*yla 2 iis perl cgi

我正在尝试在Windows 7上运行示例Perl脚本,并且我配置了IIS 7以允许ActivePerl运行但我收到此错误:

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 "Hello World. ".

Module  CgiModule
Notification    ExecuteRequestHandler
Handler Perl Script (PL)
Error Code  0x00000000
Requested URL   http://localhost:80/hello.pl
Physical Path   C:\inetpub\wwwroot\hello.pl
Logon Method    Anonymous
Logon User  Anonymous

这是我的Perl脚本:

#!/usr/bin/perl
print "Hello World.\n";
Run Code Online (Sandbox Code Playgroud)

mob*_*mob 7

从任何CGI程序返回的第一个输出应该是标题.

尝试

#!/usr/bin/perl
print "Content-type: text/plain\n\n";
print "Hello World.\n";
Run Code Online (Sandbox Code Playgroud)

  • 然后将此链接放在手边以备将来参考:http://stackoverflow.com/questions/2165022/how-can-i-troubleshoot-my-perl-cgi-script (2认同)