Html 用于访问此页面的 IIS 405 HTTP 动词不允许使用电子邮件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13047103/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:32:54  来源:igfitidea点击:

IIS 405 HTTP verb used to access this page is not allowed email

htmlperlemailiisformmail

提问by Chris

First off, I'm familiar with IIS however do not have much practical experience, hence why I have come here.

首先,我熟悉 IIS 但没有太多实践经验,因此我来到这里。

I have setup IIS7 and put my HTML website, scripts etc into the wwwroot folder. I'm able to browse the website locally just for testing purposes.

我已经设置了 IIS7 并将我的 HTML 网站、脚本等放入 wwwroot 文件夹中。我可以仅出于测试目的在本地浏览网站。

I have a webpage with a simple email form which uses Matt's Script Archive: FormMail.pl. Upon submission, I run into this error:

我有一个带有简单电子邮件表单的网页,它使用 Matt 的脚本存档:FormMail.pl。提交后,我遇到了这个错误:

 405 - HTTP verb used to access this page is not allowed.
 The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.

I'm not sure about this error or how to resolve it so the email form works.

我不确定此错误或如何解决它,以便电子邮件表单正常工作。

If you need any additional information regarding this problem, I'll provide as much info as possible.

如果您需要有关此问题的任何其他信息,我将提供尽可能多的信息。

Thanks :)

谢谢 :)

Update:

更新:

Ok, so I have modified my HTML to use the nms script. In IIS I had to enable CGI and ISAPI as they weren't installed. Once they were installed I added a Script Handler Mapping for *.pl, *cgi; also added the Verbs GET, HEAD, and POST to both of the Handler Mappings. I than used:

好的,所以我修改了我的 HTML 以使用 nms 脚本。在 IIS 中,我必须启用 CGI 和 ISAPI,因为它们没有安装。安装完成后,我为 *.pl、*cgi 添加了一个脚本处理程序映射;还向两个处理程序映射添加了动词 GET、HEAD 和 POST。我比用过:

 <!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
 <head>
 <title>Perl Test</title>
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 </head>
 <body>
 <h1>Perl is working!</h1>
 </body>
 </html>

To test if the *.pl and *.cgi is working on the localhost.

测试 *.pl 和 *.cgi 是否在本地主机上工作。

Now comes the part where I'm stuck...

现在到了我被卡住的部分......

When I click on the submit button it directs me to the formmail.cgi (formmail.pl doesn't work for some reason) however it only directs me to the cgi script, and a blank, white page.

当我单击提交按钮时,它会将我定向到 formmail.cgi(formmail.pl 出于某种原因不起作用),但它只会将我定向到 cgi 脚本和一个空白页面。

回答by Desislav Kamenov

405 means that your Web Server is not recognizing the HTTP metod(GET,POST,HEAD etc.) in the request. In your case I think that .pl extensions are not allowed by default to handle POST requests. Please refer to this link(taken from here) for creating Handler Mappings.

405 表示您的 Web 服务器无法识别请求中的 HTTP 方法(GET、POST、HEAD 等)。在您的情况下,我认为默认情况下不允许 .pl 扩展名来处理 POST 请求。请参阅此链接(取自此处)以创建处理程序映射。

回答by MacGyver

The most important thing to check with this error is the HTML tab within the Console window. Or if the error is showing in the browser, look there. In either case, look at the file type of the "Requested URL".

检查此错误的最重要的事情是控制台窗口中的 HTML 选项卡。或者,如果错误显示在浏览器中,请查看那里。无论哪种情况,请查看“请求的 URL”的文件类型。

If it's a *.json file, follow these instructions. If it's some other format, you may have to adjust the exe file that's used in the handler mapping. Make sure to configure each at the server level!!! Don't click the site before clicking the Mime Types or Handler Mappings; click on the server name (in the tree/object explorer) instead so each site inherits the settings. Your web.config gets the handler mappings applied explicitly if you set them on the site also, but it doesn't if you add it at the server level.

如果是 *.json 文件,请按照以下说明操作。如果是其他格式,则可能需要调整处理程序映射中使用的 exe 文件。确保在服务器级别配置每个!!!在单击 Mime Types 或 Handler Mappings 之前不要单击该站点;单击服务器名称(在树/对象资源管理器中),以便每个站点继承设置。如果您也在站点上设置它们,您的 web.config 会显式应用处理程序映射,但如果您在服务器级别添加它,则不会。

http://www.uipress.com/add-json-handler-support-in-iis-7/#.UT_bw9aOR8E

http://www.uipress.com/add-json-handler-support-in-iis-7/#.UT_bw9aOR8E

Since you're dealing with CGI, you will have a slightly different script map executable. That should at least get you on the right track.

由于您正在处理 CGI,因此您将拥有稍微不同的脚本映射可执行文件。这至少应该让你走上正确的轨道。