Método DELETE O .NET WebAPI não funciona
Eu vi toneladas de posts sobre isso, mas o método DELETE do meu novo WebAPI simplesmente não funciona e retorna um 404, usando o Windows 7 de 32 bits, o IIS 7.5.
eu tentei
Desinstalando o WebDAVAdicionando PUT, DELETE, OPTIONS ao manipulador ExtensionlessUrlHandler-Integrated-4.0 (e manipuladores de 32 bits / 64 bits).Permitindo que todos os módulos sejam executados.Tudo em vão e tudo retornar 404. Se eu alterar o tipo DELETE para um GET, o serviço executa o comando GET perfeitamente bem.
Alguém com alguma outra ideia sobre isso? Está me deixando louco.
EDITAR:
Eu estou chamando o método DELETE assim (mediador é um wrapper em torno da chamada jQuery):
mediator.publish("AjaxCall", {
url: "/api/files/" + $(a.currentTarget).data("fileid"),
type: "DELETE",
}
});
E WebAPI:
// DELETE api/<controller>/5
// [HttpDelete] - Tried this too
public void Delete(int fileId)
{
Files.DeleteFile(fileId);
}
E web.config relevante:
<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>