如何在IIS上为PHP应用程序启用删除、放置?

如何在IIS上为PHP应用程序启用删除、放置?,php,http,iis,azure-web-app-service,cleardb,Php,Http,Iis,Azure Web App Service,Cleardb,虽然DELETE请求在本地成功运行,但当我将我的应用部署到MS Azure时,它不起作用 以下是我在控制台中尝试删除记录时得到的结果: DELETE http://mywebsite.azurewebsites.net/api/subjects/1 405 (Method Not Allowed) 我的应用程序在cleardb 如何解决这样的问题 编辑 我的应用程序是一个PHP5.5应用程序,下面是我在web.config中尝试启用删除和放置的操作,但没有成功: <?xml versio

虽然
DELETE
请求在本地成功运行,但当我将我的应用部署到MS Azure时,它不起作用

以下是我在控制台中尝试删除记录时得到的结果:

DELETE http://mywebsite.azurewebsites.net/api/subjects/1 405 (Method Not Allowed)
我的应用程序在
cleardb

如何解决这样的问题

编辑

我的应用程序是一个PHP5.5应用程序,下面是我在
web.config
中尝试启用删除和放置的操作,但没有成功:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
        <rules>
        <rule name="Imported Rule 1" stopProcessing="true">
        <match url="^(.*)$" ignoreCase="false" />
        <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        </conditions>
                        <action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>

<validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="WebDAVModule" />
    </modules>
    <security>
      <requestFiltering>
        <verbs applyToWebDAV="false">
          <add verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS,XYZ" allowed="true" />
        </verbs>
      </requestFiltering>
    </security>

         <handlers>
<remove name="PHP55_via_FastCGI" />
  <add name="PHP55_via_FastCGI" path="*.php" verb="GET, PUT, POST, HEAD, OPTIONS, TRACE, PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK" modules="FastCgiModule" scriptProcessor="D:\Program Files (x86)\PHP\v5.5\php-cgi.exe" resourceType="Either" requireAccess="Script" />

              <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
              <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
              <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
              <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS,XYZ" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
              <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS,XYZ" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
              <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS,XYZ" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
            </handlers>

    </system.webServer>
</configuration>


我认为默认情况下,在WebApi/IIS8中,PUT和DELETE是禁用的,这看起来就像您正在使用的一样。这方面的讨论相当多。

我们需要在Web.Config文件中添加一些配置,如下所述


正如我所知,只需进入IIS用户界面,然后进行请求过滤,然后是HTTP谓词。最后,在想要的动词中添加一个新的允许规则

请检查上面的编辑啊抱歉,我不知道PHP web服务配置,我以为您在哪里使用WebApi。请检查上面的编辑此链接已失效。注意“PHP55_via_FastCGI”中GET、PUT等之间的空格处理器定义——在我的例子中是阻塞因子——不应该有空格