WebAPI – Y U NO DELETE?!!

37098508

Ok, silliness aside, WTF? At first I thought I was going insane. After wasting about 20 minutes thinking it was my fault, I realized it had to be something else. Well, it turns out that, by default, IIS Express doesn’t handle PUT and DELETE. So it isn’t a WebAPI thing, it is an IIS Express thing, but it isn’t immediately obvious what the problem is.

A little googling, a little reading, and I stumbled upon this post that explains how to update IIS Express (as well as IIS proper):

  1. Open the IIS Express config file (located at C:\Users\\Documents\IISExpress\config\applicationhost.config)
  2. Find the key “ExtensionlessUrl-Integrated-4.0”
  3. Add PUT and DELETE to the “verb”
<add name="ExtensionlessUrl-Integrated-4.0" 
     path="*." 
     verb="GET,HEAD,POST,DEBUG,PUT,DELETE" 
     type="System.Web.Handlers.TransferRequestHandler" 
     preCondition="integratedMode,runtimeVersionv4.0" />