1

I am facing issue that my Plesk IIS 7.5 on windows server 2008 don't accept DELETE method. After some reading on Stackoverflow (such as How do I enable HTTP PUT and DELETE for ASP.NET MVC in IIS?), I try to add the following to web.config file.

  <modules>
    <remove name="WebDAVModule" />
  </modules>
  <handlers>
    <remove name="WebDAV" />
  </handlers>

But after I add it, I get 500 internal server error.

This is my original web.config file:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
 <system.web>
    <customErrors mode="Off" />
  </system.web>
  <system.webServer>
    <httpErrors errorMode="Detailed" />
        <defaultDocument>
            <files>
                <clear />
                <add value="index.php" />
                <add value="default.aspx" />
                <add value="Default.htm" />
                <add value="Default.asp" />
                <add value="index.htm" />
                <add value="index.html" />
            </files>
        </defaultDocument>
        <handlers accessPolicy="Read, Execute, Script" />
        <rewrite>
            <rules>
                <rule name="Imported Rule 3" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />                     
                    </conditions>
                    <action type="Rewrite" url="index.php/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

This is my web.config file after I modify which give me 500 internal server error:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
 <system.web>
    <customErrors mode="Off" />
  </system.web>
  <system.webServer>
    <httpErrors errorMode="Detailed" />
        <defaultDocument>
            <files>
                <clear />
                <add value="index.php" />
                <add value="default.aspx" />
                <add value="Default.htm" />
                <add value="Default.asp" />
                <add value="index.htm" />
                <add value="index.html" />
            </files>
        </defaultDocument>
        <handlers accessPolicy="Read, Execute, Script" />
        <rewrite>
            <rules>
                <rule name="Imported Rule 3" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />                     
                    </conditions>
                    <action type="Rewrite" url="index.php/{R:1}" />
                </rule>
            </rules>
        </rewrite>
        <modules>
          <remove name="WebDAVModule" />
        </modules>
        <handlers>
          <remove name="WebDAV" />
        </handlers>
          </system.webServer>
</configuration>

How can I disable webDAV via web.config file and have the server accepting DELETE method?

user1995781
  • 19,085
  • 45
  • 135
  • 236
  • You may need to recycle the app pool or restart IIS for this change to take effect. If it still doesn’t work, please post a detailed error message about 500 internal server error. – samwu May 25 '21 at 08:05
  • @samwu After I have add the code and fully restart the server, I get the following message when accessing the page "500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed.". – user1995781 May 26 '21 at 06:16
  • You can use failed request tracking to view detailed error information. – samwu May 26 '21 at 09:48
  • @samwu How to use failed request tracking to view detailed error information? – user1995781 May 27 '21 at 10:10
  • Refer to this link: [Using Failed Request Tracing to Trace Rewrite Rules](https://learn.microsoft.com/en-us/iis/extensions/url-rewrite-module/using-failed-request-tracing-to-trace-rewrite-rules). – samwu May 28 '21 at 06:59
  • 1
    have you saw https://stackoverflow.com/questions/12440277/how-do-i-enable-http-put-and-delete-for-asp-net-mvc-in-iis – John Lobo May 30 '21 at 15:55
  • @JohnLobo Yes, I saw that post and I also tried some method on it. But it doesn't work. Btw, I have updated my question with `web.config` code after I modified. Maybe you can see what I did wrong from there? Thank you. – user1995781 May 31 '21 at 07:20
  • The best way is to use failed request tracking, it will tell you detailed error information. according to the error message, you can know exactly where the problem is – samwu May 31 '21 at 08:29

0 Answers0