不允许用于访问路径“/test.html”的 HTTP 动词 POST
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2209324/
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
The HTTP verb POST used to access path '/test.html' is not allowed
提问by Yves
Below is my code:
下面是我的代码:
<form id="productForm" method="post" action="test.html">
</form>
回答by jao
Are you using any URL rewriting? (http://forums.asp.net/t/953470.aspx)
您是否使用任何 URL 重写?( http://forums.asp.net/t/953470.aspx)
In the webserver, is POST allowed for HTML files? Try changing the extension to .ASPX or .PHP
在网络服务器中,是否允许对 HTML 文件进行 POST?尝试将扩展名更改为 .ASPX 或 .PHP
回答by wloescher
I found this post while working on my first Facebook app, so this may or may not be related to your underlying issue...but I was getting this same error.
我在我的第一个 Facebook 应用程序上工作时发现了这篇文章,所以这可能与您的潜在问题有关,也可能无关……但我遇到了同样的错误。
While a Canvas URL value has to end in "/", the Tabl URL can be a fully qualified page (e.g. http://[DOMAIN/DIRECTORY-PATH]/Default.aspx).
虽然 Canvas URL 值必须以“/”结尾,但 Tabl URL 可以是完全限定的页面(例如 http://[DOMAIN/DIRECTORY-PATH]/Default.aspx)。
I'm working locally, so http://localhost:4604/Main/Default.aspxworked for me.
我在本地工作,所以http://localhost:4604/Main/Default.aspx为我工作。
HttpGet, HttpPost protocols do not appear to be required in the web.config (although this fix still worked with them in there).
web.config 中似乎不需要 HttpGet、HttpPost 协议(尽管此修复程序在其中仍然适用)。
回答by Chuck Conway
回答by aefxx
This sounds like the directive is used in your (supposedly) Apache web server? You would need to check the httpd.conf for this directive and make sure that POST is allowed to be called on your file.
这听起来像是在您的(据说)Apache Web 服务器中使用了该指令?您需要检查此指令的 httpd.conf,并确保允许在您的文件上调用 POST。
Nevertheless does it seem a little odd to POST on a static html file or is mod_rewrite being used to confuse people?
然而,在静态 html 文件上发布 POST 似乎有点奇怪,还是使用 mod_rewrite 来迷惑人们?
回答by Joel Etherton
The default for this error is that the POST verb is turned off at the configuration for the server. Is this happening in Cassini or in IIS? In IIS this behavior can be controlled. Also you may want to make sure that the proper handlers are in your web.config if you are still having issues after looking at the IIS configuration (if this ends up being web service related):
此错误的默认设置是在服务器配置中关闭 POST 谓词。这是发生在 Cassini 中还是发生在 IIS 中?在 IIS 中,可以控制这种行为。此外,如果您在查看 IIS 配置后仍然遇到问题(如果这最终与 Web 服务相关),您可能需要确保正确的处理程序在您的 web.config 中:
<system.web>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>