Elmah is working alright catching exceptions that are unhandled. However, in one place I am using the following code to manually log error incase a webapi action causes exception. This error is somehow not displayed in elmah.axd
wonder why?
Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
Here is something I didn't notice earlier, log in debug window:
Exception thrown: 'System.Web.HttpRequestValidationException' in System.Web.dll
System.Web.HttpRequestValidationException (0x80004005): A potentially dangerous Request.Form value was detected from the client (headers="...8241F for <x+152@mail....").
at System.Web.HttpRequest.ValidateString(String value, String collectionKey, RequestValidationSource requestCollection)
at System.Web.HttpRequest.<>c__DisplayClass280_0.<ValidateHttpValueCollection>b__0(String key, String value)
at System.Web.HttpValueCollection.EnsureKeyValidated(String key)
at System.Web.HttpValueCollection.GetValues(Int32 index)
at System.Collections.Specialized.NameValueCollection.Add(NameValueCollection c)
at Elmah.Error.CopyCollection(NameValueCollection collection)
at Elmah.Error..ctor(Exception e, HttpContext context)
at Elmah.ErrorLogModule.LogException(Exception e, HttpContext context)
More Context to the question:
Basically, I have an action method in webapi which parses and processes incoming email parse from sendgrid. If any type of exception occurs, it is manually logged with ELMAH and Application Insights in Azure. Application Insight logging works while ELMAH is failing with the above error message.