PUT and DELETE method does not work in WebAPI (error 405)

This is one of the most common cases. Hosting users face a problem when, after publishing a WebAPI application on a hosting, calls to the PUT and DELETE methods do not work. The web server returns an error:

HTTP Error 405.0 - Method Not Allowed. The page you are looking for cannot be displayed due to using an invalid method (HTTP command)

The problem is eliminated by adding the sections described below to the web.config file:

      <remove name="WebDAVModule"/>
      <remove name="WebDAV" />
      <remove name="ExtensionlessUrl-Integrated-4.0" />
      <add name="ExtensionlessUrl-Integrated-4.0"
           preCondition="integratedMode,runtimeVersionv4.0" />