Issues with WebApi Delete and Update Commands

Another day at the office.

After running through someĀ Pluralsight training in relation to WebApi development my colleagues and I discovered whilst trying to follow the tutorial that Delete and Update methods (PUT and DELETE verbs) implemented within the controller classes would not seem to work. A little bit of head scratching, double checking and digging later revealed that the issue was due to a configuration issue with IIS8. It seems that out of the box IIS8 ships with the verbs PUT and DELETE disabled. The issue was resolved very simply by:-

1. Opening the IIS8 ApplicationHost.Config file located within the directory ‘%userprofile%\documents\iisexpress\config”

2. Change the “Verb” values from the following line

<add name="ExtensionlessUrl-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />

to read

<add name="ExtensionlessUrl-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />

Note the inclusion of the PUT and DELETE verbs.

3. Now recompile and run your code, which should restart your web server and hey presto your Delete and Update methods should work as intended.