【发布时间】:2019-03-02 07:18:34
【问题描述】:
我正在尝试像这样使用 Elmah 引发异常:
try
{
Foo();
}
catch (WebException ex)
{
var nex = new Exception("Foo failed", ex);
Elmah.ErrorSignal.FromCurrentContext().Raise(nex);
}
但是,Elmah 记录的是内部异常ex,而不是我的新包装异常nex,即生成的数据库记录具有:
Type = "System.Net.WebException", Message = "The remote server returned an error: (400) Bad Request."
而不是像我期望的那样:
Type = "System.Exception", Message = "Foo failed"
到底发生了什么?
【问题讨论】:
-
elmah 的配置在哪里?
-
在 web.config 中
-
你能在测试项目中重新创建它吗?
-
请您添加配置设置。