Search code examples
asp.net-web-apiowinkatanahttp-status-code-405

Owin self-host Web API 405 method not allowed on DELETE


I am creating an Owin self-host Web API and getting a 405 method not allowed response when posting a DELETE request the server. POST and GET seem to work with not problems.

I can reproduce the error in the ASP.Net Sample application OwinSelfHostSample project at https://aspnet.codeplex.com/SourceControl/latest#Samples/WebApi/OwinSelfhostSample/ReadMe.txt

I do not have WebDAV installed and using Fiddler the request is formed with no apparent issues. I also have Cors installed and set to AllowAll.

Any suggestions as to what is blocking 405?


Solution

  • Ok so I know this is lame but I found the problems minutes after posting this. I did spend about 3 hours trying to figure this out. Apparently the issue was with Routing. My ID is a string so I gave it the action parameter the name of the column instead of "id" which is what the default route is configured to look for. Once I changed the action parameter name to "id" it worked as expected.