-1

When I execute this line of code

Elmah.ErrorSignal.FromCurrentContext().Raise(context.Exception);

I get the following error

enter image description here

With the following stack trace...

       at Elmah.Error..ctor(Exception e, HttpContext context)
   at Elmah.ErrorMailModule.OnError(Exception e, HttpContext context)
   at Elmah.ErrorMailModule.OnErrorSignaled(Object sender, ErrorSignalEventArgs args)
   at Elmah.ErrorSignalEventHandler.Invoke(Object sender, ErrorSignalEventArgs args)
   at Elmah.ErrorSignal.Raise(Exception e, HttpContext context)
   at Elmah.ErrorSignal.Raise(Exception e)
   at Ideal.API.Filters.UnhandledExceptionFilter.OnException(HttpActionExecutedContext context) in C:\Repositories\edgemvc-ideal\Ideal.API\Filters\HandleErrorActionFilter.cs:line 10
   at System.Web.Http.Filters.ExceptionFilterAttribute.OnExceptionAsync(HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken)

I have tried several versions of the email

<elmah>
    <errorMail 
      from="from" 
      to="to" 
      subject="subject" 
      async="true|false" 
      smtpPort="587|0" 
      smtpServer="smtpServer" 
      userName="userName" 
      password="password"
      useSsl="true|false"/>
  </elmah>

Here's what I get from google :( enter image description here

Rod Johnson
  • 2,387
  • 6
  • 30
  • 48
  • I created a project from scratch and have no issues with this code, I'm wondering if there is some config setting that would cause this error. – Rod Johnson Jul 01 '16 at 21:14
  • You should probably paste your entire web.config here for anyone to be able to help. Also, you could try to validate your ELMAH config using the ELMAH Configuration Validator: https://elmah.io/tools/configvalidator – ThomasArdal Jul 07 '16 at 06:38

1 Answers1

0

What is null here? Based on the information provided it seems that there is no httpcontext when the above code is being executed.

Ajit Goel
  • 4,180
  • 7
  • 59
  • 107