Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Elmah未在数据库中记录异常_C#_Asp.net Mvc_Elmah - Fatal编程技术网

C# Elmah未在数据库中记录异常

C# Elmah未在数据库中记录异常,c#,asp.net-mvc,elmah,C#,Asp.net Mvc,Elmah,我试图使用Elmah将应用程序中出现的所有异常记录到数据库中。但它不起作用。无论何时Elmah.ErrorSignal.FromCurrentContext().Raise(异常)被称为错误,但未将其插入数据库 代码片段 Logger.cs 公共类记录器 { 公共静态无效日志异常(异常) { if(HttpContext.Current==null) { Elmah.ErrorLog.GetDefault(null.Log)(新错误(异常)); } 其他的 { Elmah.ErrorSigna

我试图使用Elmah将应用程序中出现的所有异常记录到数据库中。但它不起作用。无论何时
Elmah.ErrorSignal.FromCurrentContext().Raise(异常)被称为错误,但未将其插入数据库

代码片段

  • Logger.cs
  • 公共类记录器
    {
    公共静态无效日志异常(异常)
    {
    if(HttpContext.Current==null)
    {
    Elmah.ErrorLog.GetDefault(null.Log)(新错误(异常));
    }
    其他的
    {
    Elmah.ErrorSignal.FromCurrentContext().Raise(异常);
    }
    }
    公共静态无效日志消息(字符串消息)
    {
    if(ServiceConfiguration.ShouldLogMessage)
    {
    Logger.LogException(新异常(消息));
    }
    }
    }
    尝试添加

    <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
    
    
    
    元素内的
    元素中

    乌罗斯