2017-01-03 46 views
2

我手動註銷某些錯誤是這樣的:手動登錄ELMAH錯誤不發送電子郵件

ApplicationException ex = new ApplicationException("Testing"); 

Elmah.ErrorLog.GetDefault(System.Web.HttpContext.Current).Log(new Elmah.Error(ex)); 

未處理的異常發送電子郵件,但手工記錄的人都沒有。我也試過這樣:

Elmah.ErrorSignal.FromCurrentContext().Raise(ex); 

我如何獲得這些手工記錄的錯誤發送電子郵件(沒有出現,並顯示自定義錯誤頁)?

回答

3

我說得太快了。

這不會發送電子郵件:

Elmah.ErrorLog.GetDefault(System.Web.HttpContext.Current).Log(new Elmah.Error(ex)); 

但這:

Elmah.ErrorSignal.FromCurrentContext().Raise(ex);