How WebDAV prevents PUT requests from working

The story in a nutshell: you suddenly start receiving “405 method not allowed” response to PUT requests to your ASP.NET web service.

This problem hit us last September, but I did not blog about it then, but today we stepped on it again, so I am practically obligated to put it in the blog.

The culprit is WebDAV. If WebDAV is installed on the server, it becomes the first handler, and intercepts all PUT and DELETE requests, so they don’t even reach your ASP.NET application. The config file where this info is C:\Windows\System32\inetsrv\config\applicationHost.config.

<handlers accessPolicy="Read, Script">
<add name="WebDAV" path="*"  
       verb="PROPFIND,PROPPATCH,MKCOL,PUT,COPY,DELETE,MOVE,LOCK,UNLOCK" 
       modules="WebDAVModule" 
       resourceType="Unspecified" 
       requireAccess="None" />

The simplest solution is to uninstall WebDAV. If this cannot be done, one needs to change the path="*" part.
See also: http://www.asp.net/web-api/overview/testing-and-debugging/troubleshooting-http-405-errors-after-publishing-web-api-applications.

Leave a Reply

Your email address will not be published. Required fields are marked *