I have a an action on my Email
Web API 2 controller:
[Authorize]
[RoutePrefix("api/Email")]
public class EmailController : ApiController {
//...
[HttpDelete]
[Route("Remove/{id}")]
private void Remove(int id) {
_repo.Remove(id);
}
}
When I call the action from Fiddler with DELETE
http://localhost:35191/api/Email/Remove/35571
(or by any other method) I get a 500
back with the generic IIS error page that gives me no information on the error.
It seems the error is occurring before my action is ever called because setting a breakpoint within the action results in the breakpoint never being hit.
Is there some sort of configuration required to allow DELETE
methods in IIS (Express)?
I've tried explicitly allowing DELETE
in my web.config:
<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" />
but to no avail.
You have to make your exposed methods public
:
[HttpDelete]
[Route("Remove/{id}")]
public void Remove(int id) {
_repo.Remove(id);
}
If that didn't work then you probally need to remove the WebDav(web.config):
<system.webServer>
<modules>
<remove name="WebDAVModule" />
</modules>
<handlers>
<remove name="WebDAV" />
</handlers>
</system.webServer>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With