Configuring and Troubleshooting PUT and DELETE Verbs in ASP.NET Web API on IIS 8

Nov 27, 2025 · Programming · 12 views · 7.8

Keywords: ASP.NET | Web API | IIS 8 | PUT | DELETE | 405 Error

Abstract: This article explores the issue of blocked PUT and DELETE HTTP verbs in ASP.NET Web API when deployed on IIS 8. By analyzing the root causes of 405 errors, it provides solutions through modifications to applicationhost.config and web.config files, including extending the verb list of the ExtensionlessUrl handler and disabling the WebDAV module. Additionally, it covers the default method naming conventions in Web API to ensure proper configuration and debugging of RESTful services.

Problem Background and Error Analysis

After upgrading to Visual Studio 2012 RC with IIS 8 Express as the default web server, many developers report that PUT and DELETE requests in their ASP.NET Web API are blocked, resulting in IIS returning a 405 error with the message "The requested resource does not support http method 'PUT'." This issue typically stems from IIS 8's default configuration, where the ExtensionlessUrl handler does not include these verbs, and the WebDAV module may interfere with request processing.

Core Solution: Modifying applicationhost.config

To enable PUT and DELETE verbs, first edit the applicationhost.config file located at %userprofile%\documents\iisexpress\config\applicationhost.config. Locate the handler entry named "ExtensionlessUrl-Integrated-4.0", whose original configuration only allows GET, HEAD, POST, and DEBUG verbs. By modifying the verb attribute to include PUT and DELETE, for example: <add name="ExtensionlessUrl-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />, you can extend the handler's support range. This change ensures that IIS correctly routes PUT and DELETE requests to the Web API controllers.

Disabling WebDAV Module Interference

The WebDAV module is enabled by default in IIS 8 and may intercept PUT and DELETE requests, causing conflicts. To avoid this, it is recommended to comment out or remove WebDAV-related entries in applicationhost.config. Specifically, include: <add name="WebDAVModule" image="%IIS_BIN%\webdav.dll" />, <add name="WebDAVModule" />, and <add name="WebDAV" path="*" verb="PROPFIND,PROPPATCH,MKCOL,PUT,COPY,DELETE,MOVE,LOCK,UNLOCK" modules="WebDAVModule" resourceType="Unspecified" requireAccess="None" />. Removing these configurations eliminates WebDAV interference with RESTful verbs.

Alternative Configuration via Web.config

In addition to modifying applicationhost.config, configurations can be applied in the project's web.config file for better portability. Under the <system.webServer> node, add module and handler configurations: <modules runAllManagedModulesForAllRequests="true"><remove name="WebDAVModule"/></modules> and <handlers><remove name="WebDAV" /><remove name="ExtensionlessUrl-Integrated-4.0" /><add name="ExtensionlessUrl-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /></handlers>. This approach ensures consistent configuration across different deployment environments.

Web API Method Naming Conventions

ASP.NET Web API defaults to a method naming convention based on HTTP verbs. For instance, a method handling DELETE requests should be named Delete, while one for PUT requests should be named Put. If method names do not match, even with correct server configuration, it may lead to 404 errors. Developers should verify method names in controllers to ensure alignment with intended verbs.

Testing and Verification Steps

After implementing the above changes, restart IIS Express or the application pool and test PUT and DELETE requests using tools like Postman or browser developer tools. Send sample requests to API endpoints and check if the response status code is 200 or 204, rather than 405. If issues persist, inspect configuration files for syntax errors or use IIS logs for further debugging.

Summary and Best Practices

Resolving blocked PUT and DELETE verbs in IIS 8 hinges on correctly configuring the ExtensionlessUrl handler and disabling the WebDAV module. Prefer using web.config for configurations to enhance application portability. Additionally, adhere to Web API naming conventions to avoid common pitfalls. Through these steps, developers can ensure that RESTful APIs function properly in IIS 8 environments.

Copyright Notice: All rights in this article are reserved by the operators of DevGex. Reasonable sharing and citation are welcome; any reproduction, excerpting, or re-publication without prior permission is prohibited.