2010-04-29 62 views
2

我想在Windows 7上運行示例Perl腳本,我配置了IIS 7允許的activeperl運行,但我得到這個錯誤:爲什麼我的IIS上的Perl CGI程序出現「Bad Gateway」錯誤?

 
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"; 

回答

7

從任何CGI程序返回的第一個輸出應該是標題。

嘗試

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

然後保留本鏈接以便日後參考:http://stackoverflow.com/questions/2165022/how-can-i-troubleshoot-my-perl-cgi-script – mob 2010-04-29 22:56:58

+0

謝謝你現在工作太多了。 – Eyla 2010-04-29 23:00:18

相關問題