如何在 IIS 7 上配置 CGI?
我这样做了
http://reboltutorial.com/images/rebol-iis.png
如此处所述,但它适用于 IIS 6 http://rebolforum.com/index.cgi?f= printtopic&topicnumber=39&archiveflag=new
我还为应用程序池激活了 32 位,如此处所述 http://blogs. iis.net/wadeh/archive/2009/04/13/running-perl-on-iis-7.aspx
但是当浏览到测试脚本时它不起作用,似乎永远没有显示任何内容,然后最后显示此消息错误:
502 - Web server received an invalid response while acting as a gateway or proxy server.
There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.
我在 Windows 2008 上使用了专用服务器
测试脚本的源代码:
REBOL [Title: "Cgi Test in Rebol"]
print "HTTP/1.0 200 OK^/Content-type:text/html^/^/";
print []
print ["Date/time is:" now]
print []
我应该询问服务器故障而不是这里似乎没有人知道吗?
I did this
http://reboltutorial.com/images/rebol-iis.png
as explained here but it was for IIS 6
http://rebolforum.com/index.cgi?f=printtopic&topicnumber=39&archiveflag=new
I also activated 32 bits for application pool as explained here
http://blogs.iis.net/wadeh/archive/2009/04/13/running-perl-on-iis-7.aspx
But when browsing to the test script it doesn't work, seems to take forever showing nothing, then in the end shows this message error:
502 - Web server received an invalid response while acting as a gateway or proxy server.
There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.
I used a dedicated server on windows 2008
Source code of the test script:
REBOL [Title: "Cgi Test in Rebol"]
print "HTTP/1.0 200 OK^/Content-type:text/html^/^/";
print []
print ["Date/time is:" now]
print []
Should I ask on serverfault rather as nobody seems to know here ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最后我得到了答案,步骤如下:
从管理工具中打开服务器管理器。
添加角色“Web 服务器 (IIS)”
在浏览器中尝试
http://localhost/
。您应该看到 IIS7 欢迎页面。将 core.exe 复制到 c:\(或其他位置),右键单击 core.exe 并打开属性窗口,给出 Read &在“安全”选项卡下执行对 IUSR_xxxx 的访问。 (如果您有任何问题,请尝试为每个人提供读取和执行)
从管理员工具中打开“Internet 信息服务(IIS)管理器”。
单击“默认网站”,双击“处理程序映射”,单击右侧面板中的“添加模块映射”,然后键入以下内容:
当出现“添加脚本映射”对话框时,选择“是”。它将按照 ISAPI 和 CGI 限制列表的允许添加 c:\core.exe -cs "%s %s"。
在 wwwroot 文件夹下创建一个 test.r 文件。我的 test.r 文件包含以下脚本:
并在浏览器上输入
http://localhost/test.r
。如果一切顺利,那么它应该可以工作。
如果您尝试使用 View.exe,则可能需要将 --noinstall 放入命令行,否则当 View 使用 IUSR_xxx 用户帐户启动时,它将打开桌面和桌面。安装窗口并保持在后台(您可以从任务管理器中看到它)。
如果您的脚本位于包含空格的路径中,您可能还需要在 %s 两边加上双引号。使用以下形式:
而不是这样:
我希望这会有所帮助。
更新:我在 IIS6(Windows 2003 Server)上遇到了一个问题,当我按如下方式配置它时,它给出 404(它在 IIS7 上工作,如上所述):
但它运行如下:
这是 Perl 安装的链接。
http:// www.howtogeek.com/50500/how-to-install-perl-on-iis-6-for-windows-server-2003/
Finally I got my answer, here are the steps:
Open Server Manager from Administrative Tools.
Add role "Web Server (IIS)"
Try
http://localhost/
from your browser. You should see the IIS7 Welcome Page.Copy core.exe to c:\ (or somewhere else), right click on core.exe and open Properties window, give Read & Execute access to IUSR_xxxx under Security tab. (If you've any problem, try to give Read & Execute for Everyone)
Open "Internet Information Services (IIS) Manager" from Administrator Tools.
Click on Default Web Sites, double click on Handler Mappings, click on Add Module Mapping from the right panel and type the followings:
Select Yes when Add Script Map dialog box appears. It will add the c:\core.exe -cs "%s %s" as allowed under ISAPI and CGI Restrictions list.
Create a test.r file under wwwroot folder. My test.r file contains following script:
And type
http://localhost/test.r
on your browser.If everything goes well then it should work.
If you are trying with View.exe then you may need to put --noinstall to command line, otherwise when View start with IUSR_xxx user account it will open desktop & installation window and it stays background (you can see it from Task Manager).
You may also need to put double quotes around %s if your script is in a path with spaces. Use the following form:
Instead of this:
I hope this will help.
UPDATE: I've faced a problem on IIS6 (Windows 2003 Server), it gives 404 when I configure it as follow (it works on IIS7 as told above):
But it runs as:
Here is the link for Perl installation.
http://www.howtogeek.com/50500/how-to-install-perl-on-iis-6-for-windows-server-2003/