The ASP.NET Web API convention annoyed me so much, well because I’m not proficient in Web API yet. By convention, your action name in Web API should match/contain the Http Verb name. I spent about 45 minutes trying to fix this thing! So now I hope I won’t forget that 🙂

IIS or Windows Azure does not recognize DELETE, PUT and some other Http verbs by default. I found this fix online while trying to fix an Http 404 error from my Web API controller.

Below is the exact code I used:

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

If the code above does not fix your issue, I read that removing “WebDav” and “WebDavModule” could help resolve the issue. Below is the complete snippet – the snippet I used in bold

<system.webServer><br /> <validation validateIntegratedModeConfiguration="false" /><br /> <modules runAllManagedModulesForAllRequests="true"><br /> <remove name="WebDAVModule"/><br /> </modules><br /> <handlers><br /> <remove name="WebDav"/><br /> <remove name="ExtensionlessUrl-ISAPI-4.0_32bit" /><br /> <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" /><br /> <remove name="ExtensionlessUrlHandler-Integrated-4.0" /><br /> <strong><remove name="ExtensionlessUrl-Integrated-4.0" /></strong><br /> <add name="ExtensionlessUrl-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /><br /> <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /><br /> <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /><br /> <strong><add name="ExtensionlessUrl-Integrated-4.0" path="*."</strong><br /> <strong> verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS"</strong><br /> <strong> type="System.Web.Handlers.TransferRequestHandler"</strong><br /> <strong> preCondition="integratedMode,runtimeVersionv4.0" /></strong><br /> </handlers><br /> </system.webServer>

The code snippet below is for media types we usually use on the web to keep IIS or Windows Azure happy serving static content, you can add/remove stuff depending on your needs. _Please note this is also inside <_system.webServer> of your Web.config.

<staticContent><br /> <remove fileExtension=".eot" /><br /> <remove fileExtension=".ttf" /><br /> <remove fileExtension=".otf"/><br /> <remove fileExtension=".woff"/><br /> <remove fileExtension=".mp4"/><br /> <remove fileExtension=".ogv"/><br /> <remove fileExtension=".webm"/><br /> <remove fileExtension=".svg"/><br /> <mimeMap fileExtension=".eot" mimeType="application/" /><br /> <mimeMap fileExtension=".ttf" mimeType="font/ttf" /><br /> <mimeMap fileExtension=".otf" mimeType="font/otf" /><br /> <mimeMap fileExtension=".woff" mimeType="application/font-woff" /><br /> <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" /><br /> <mimeMap fileExtension=".mp4" mimeType="video/mp4" /><br /> <mimeMap fileExtension=".ogv" mimeType="video/ogg" /><br /> <mimeMap fileExtension=".webm" mimeType="video/webm" /><br /> <mimeMap fileExtension=".svg" mimeType="image/svg+xml"/><br /> </staticContent>


I think you have noticed this by now as well, it is good practice to remove something in your Web.config first before adding it again, to make sure you don’t get duplicates. That’s it for tonight 🙂