Enable “PUT” and “DELETE” verbs in IIS 7+

Is your newly created RESTful Service returning a 405 on your PUT and DELETE actions when running in IIS 7? If so you may need to disable WebDAV.

A quick way to check is to pop the following lines into a Web.config in the root of your application and try again.

<system.webServer>
 <modules>
  <remove name="WebDAVModule" />
 </modules>
 <handlers>
  <remove name="WebDAV" />
 </handlers>
</system.webServer>

UPDATE 2016-04-22: For those .NET users, if your server is still not responding to DELETE or PUT check to ensure that the ExtensionlessUrl-Integrated-4.0 handler is setup to handle the verbs by dropping these additional settings in your web.config

<system.webServer>
    <modules>
      <remove name="WebDAVModule" />
    </modules>
    <handlers>
      <remove name="ExtensionlessUrl-Integrated-4.0" />
      <remove name="WebDAV" />
      <add name="ExtensionlessUrl-Integrated-4.0" path="*." 
      		verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" 
      		type="System.Web.Handlers.TransferRequestHandler" 
      		resourceType="Unspecified" requireAccess="Script" 
      		preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
  </system.webServer>

Leave a Reply

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