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

时间:2010-04-29 22:50:49

标签: perl iis 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";

1 个答案:

答案 0 :(得分:7)

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

尝试

#!/usr/bin/perl
print "Content-type: text/plain\n\n";
print "Hello World.\n";