Note that there are some explanatory texts on larger screens.

plurals
  1. PODELETE method .NET WebAPI does not work
    text
    copied!<p>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.</p> <p>I've tried</p> <ul> <li>Uninstalling WebDAV</li> <li>Adding PUT, DELETE, OPTIONS to the ExtensionlessUrlHandler-Integrated-4.0 handler (and 32bit/64bit handlers).</li> <li>Allowing all modules to run.</li> </ul> <p>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.</p> <p>Anyone with any other ideas about this? It's driving me crazy. </p> <p>EDIT:</p> <p>I'm calling the DELETE method like this (mediator is a wrapper around the jQuery call):</p> <pre><code>mediator.publish("AjaxCall", { url: "/api/files/" + $(a.currentTarget).data("fileid"), type: "DELETE", } }); </code></pre> <p>And WebAPI:</p> <pre><code>// DELETE api/&lt;controller&gt;/5 // [HttpDelete] - Tried this too public void Delete(int fileId) { Files.DeleteFile(fileId); } </code></pre> <p>And relevant web.config:</p> <pre><code>&lt;handlers&gt; &lt;remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" /&gt; &lt;remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" /&gt; &lt;remove name="ExtensionlessUrlHandler-Integrated-4.0" /&gt; &lt;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" /&gt; &lt;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" /&gt; &lt;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" /&gt; &lt;/handlers&gt; &lt;modules runAllManagedModulesForAllRequests="true"&gt; &lt;remove name="WebDAVModule" /&gt; &lt;/modules&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload