I've seen tons of posts about this, but the DELETE method of my new WebAPI simply does not work and returns a 404, using Windows 7 32-bit, IIS 7.5.
I've tried
- Uninstalling WebDAV
- Adding PUT, DELETE, OPTIONS to the ExtensionlessUrlHandler-Integrated-4.0 handler (and 32bit/64bit handlers).
- Allowing all modules to run.
All to no avail and all return 404. If I change the DELETE type to a GET, then the service runs the GET command perfectly fine.
Anyone with any other ideas about this? It's driving me crazy.
EDIT:
I'm calling the DELETE method like this (mediator is a wrapper around the jQuery call):
mediator.publish("AjaxCall", {
url: "/api/files/" + $(a.currentTarget).data("fileid"),
type: "DELETE",
}
});
And WebAPI:
// DELETE api/<controller>/5
// [HttpDelete] - Tried this too
public void Delete(int fileId)
{
Files.DeleteFile(fileId);
}
And relevant web.config:
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-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" />
<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" />
<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" />
</handlers>
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule" />
</modules>
DELETE
method - what's the client side of this setup? – Damien_The_UnbelieverOPTIONS
and seeing whether that gets hit first?) – Damien_The_Unbeliever