I\'ve tried many elmah nugets but they didn\'t work with ASP.NET Web API. Does anybody knows why? Is there any work around for that?
Check the below URL it describe in details how to use elmah with Web API:
http://blogs.msdn.com/b/webdev/archive/2012/11/16/capturing-unhandled-exceptions-in-asp-net-web-api-s-with-elmah.aspx
You can also use the NuGet Package below:
Install-Package Elmah.Contrib.WebApi
Usage:
Simply register it during your application's start up, or on a controller-by-controller basis.
protected void Application_Start() { GlobalConfiguration.Configuration.Filters.Add(new ElmahHandleErrorApiAttribute()); ... }
(from the Elmah.Contrib.WebApi GitHub repo)