.NET Web API 2 and IIS PUT/DELETE not working

.net, asp.net-web-api, iis

Solution

The `id` parameter is not present in the route template. Change your controller-level route to `[Route("api/apps/{id?}")]` maybe or supply the id value from querystring...

Problem

On DELETE requests to my Web API 2 controller, I get: ``` Request URL:http://localhost/phoenix/api/apps/1245 Request Method:DELETE Status Code:404 Not Found DELETE http://localhost/myapp/api/apps/1245 404 (Not Found) ``` my controller looks like: ``` [EnableCors(origins: "http://localhost", headers: "*", methods: "*", SupportsCredentials = true)] [Route("api/apps")] public class ApplicationController : ApiController { // DELETE api/apps/5 public void Delete(string id) { //apps.Delete(id); } } ``` and my IIS is setup for the PUT/DELETE verbs: and my web.config has has * for verbs: ``` <system.webServer> <handlers> <remove name="ExtensionlessUrlHandler-Integrated-4.0" /> <remove name="OPTIONSVerbHandler" /> <remove name="TRACEVerbHandler" /> <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> </handlers> </system.webServer> ``` What am I missing?

Original source