不允许 POST 动词 [英] POST verb not allowed

查看:37
本文介绍了不允许 POST 动词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有点基础,但我尝试了一些方法来解决以下错误,但无法获得正确的解决方案.

A bit basic, but I have tried some of the methods to tackle the following error but could not get the right solution.

<!DOCTYPE html>

<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title></title>
    </head>
    <body>
        <form  method="post">
            <input type="text" name="query1"></input>
            <input type="text" name="query2"></input>
            <input type="submit"></input>

        </form>
    </body>
</html>

运行时出错:HTTP 错误 405.0 - 不允许的方法由于使用了无效的方法(HTTP 动词),您正在查找的页面无法显示.

Error on running : HTTP Error 405.0 - Method Not Allowed The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.

在 IIS 的映射中,我添加了 POST 方法但是没有用!请提出建议!

In the mappings of IIS, I have added the POST method but that did not work! Suggestions please!

推荐答案

以下代码为我解决了这个问题(适用于 iis 上的 php).

The following code has solved the problem for me(it's for php on iis).

web.config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers accessPolicy="Read, Execute, Script">
            <remove name="PHP55_via_FastCGI" />
            <add name="PHP55_via_FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.5\php-cgi.exe" resourceType="Either" requireAccess="Script" />
            <add name="HTML_via_FastCGI" path="*.html" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.5\php-cgi.exe" resourceType="Either" requireAccess="Script" />
            <add name="HTM_via_FastCGI" path="*.htm" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.5\php-cgi.exe" resourceType="Either" requireAccess="Script" />
        </handlers>
        <security>
            <requestFiltering>
                <fileExtensions>
                    <add fileExtension=".php" allowed="true" />
                </fileExtensions>
                <verbs>
                    <add verb="POST"   allowed="true" />
                    <add verb="GET"    allowed="true" />
                    <add verb="HEAD"   allowed="true" />
                    <add verb="DELETE" allowed="true" />
                    <add verb="PUT"    allowed="true" />
                </verbs>
        </requestFiltering>
    </security>
</system.webServer>

这篇关于不允许 POST 动词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆