How to make IIS support Put and delete requests

Recently, because of project release and deployment, I often encounter requests that IIS does not support PUT and delete in the project. Now record it in case you forget it.

Problem description: Generally, when IIS does not support PUT and Delete requests, it will report 405 or 500 errors, as follows: Insert picture description here
Insert picture description here
Insert picture description here
1. Deployment environment: IIS 8.5 If you don’t know the version number, you can open IIS to view the version number:
Insert picture description here
Insert picture description here
2. Analysis of the cause of the problem : By default, IIS will install a WebDav module, and this module prevents HTTP PUT and Delete requests.

Three, the solution:

①Delete the WebDav module installed by IIS, select your project, there is a "module" on the right, double-click it; find WebDavModule, delete it.
Insert picture description here
Insert picture description here
Modify the web.config of your project and add the following code in the <system.webServer> tag.

     <modules runAllManagedModulesForAllRequests="true" runManagedModulesForWebDavRequests="true">
           <remove name="WebDAVModule"/>
      </modules>
       <handlers>
          <remove name="WebDAV" />
        </handlers>
       

Reprinted: https://blog.csdn.net/lynehylo/article/details/80623190?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog- BlogCommendFromMachineLearnPai2-2.control

Guess you like

Origin blog.csdn.net/weixin_40648700/article/details/112170891