How to remove WebDAV module from IIS?

2019-05-03 17:37发布

I am struggling for days to enable PUT and DELETE request for my PHP app at MS Azure. Some answers I found suggest to remove the WebDAV module from IIS.

How would I do so?

4条回答
Root(大扎)
2楼-- · 2019-05-03 18:15

This response is good. Basically put it in the Web.config. This is what @shiitake is doing.

I've beeen using that solution for a while but its annoying because I have to maintain it in my Web.config when the rest of the developers don't. So I removed it from IIS all together.

  1. Open IIS and go to the site in question.
  2. Click on "Handler Mappings"
  3. Find the handler named "WebDAV"
  4. Select it and Remove it

On first try I got, Error: Cannot write configuration file due to insufficient permissions. Full disclosure, my coworker fixed it for me and sent the following instructions. (Maybe someone can edit and clarify the steps.)

  1. Stop the site
  2. Add yourself to Security Group
  3. Remove the handler.
查看更多
狗以群分
3楼-- · 2019-05-03 18:22

I am hosting a PHP application in Azure App Services and I was able to solve this problem by manually creating a file called web.config and adding it to the root directory of my web application.

Here is the entire content of that file.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <security>
        <requestFiltering>
            <verbs allowUnlisted="false">
                <add verb="GET" allowed="true" />
                <add verb="POST" allowed="true" />
                <add verb="DELETE" allowed="true" />
                <add verb="PUT" allowed="true" />
            </verbs>
        </requestFiltering>
    </security>
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="WebDAVModule" />
    </modules>
    <handlers>
      <remove name="WebDAV" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <remove name="PHP56_via_FastCGI" />
      <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" />
      <add name="PHP56_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.6\php-cgi.exe" resourceType="Either" requireAccess="Script" />
    </handlers>
  </system.webServer>
</configuration>

You'll notice in the handlers section it references PHP56_via_FastCGI. This is specific to PHP 5.6. If you are using a different version of PHP you will need to update the name and file path to reflect that version.

查看更多
该账号已被封号
4楼-- · 2019-05-03 18:23

I think there is already solution for your problem in previous post in stackoverflow.

Try this out and hopefully it helps! https://stackoverflow.com/a/16275723/3203213

查看更多
戒情不戒烟
5楼-- · 2019-05-03 18:37

I've spent a whole day on this and tried every solution I ran into yet nothing worked for me. What finally worked was turning off the "WebDAV Publishing" feature from Turn Windows features on or off. This is located under:

Internet Information Services\World Wide Web Services\Common HTTP Features\WebDAV Publishing.

查看更多
登录 后发表回答