为什么我会收到“错误网关”消息我的 Perl CGI 程序在 IIS 上出错?

发布于 2024-08-30 19:35:09 字数 587 浏览 2 评论 0原文

我正在尝试在 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";

I'm trying to run sample Perl script on Windows 7 and I configured IIS 7 to allow ActivePerl to run but I'm getting this error:

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

and here is my Perl script:

#!/usr/bin/perl
print "Hello World.\n";

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

肩上的翅膀 2024-09-06 19:35:09

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

尝试

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

The first output returned from any CGI program should be the headers.

Try

#!/usr/bin/perl
print "Content-type: text/plain\n\n";
print "Hello World.\n";
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文