Hangfire错误`SQL错误日志缺少连接字符串

时间:2017-06-07 05:48:59

标签: c# sql-server hangfire

我正忙着尝试将hangfire添加到我的MVC项目中。我正在关注Quick Start Guide

我已将此添加到我的startup.cs文件

   public void Configuration(IAppBuilder app)
    {
        ConfigureAuth(app);          

        //Hangfire
        GlobalConfiguration.Configuration.UseSqlServerStorage("data source=ip;initial catalog=Name;user id=Hangfire;password=Password;");
        app.UseHangfireDashboard();
        app.UseHangfireServer();
    }

然而,当我运行我的项目时,我收到以下错误:(它突出显示了我的startup.cs类中的GlobalConfiguration.Configuration.UseSqlServerStorage行)

Connection string is missing for the SQL error log.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: Elmah.ApplicationException: Connection string is missing for the SQL error log.

2 个答案:

答案 0 :(得分:1)

我相信您拥有当前的记录器,因为Elmah和Hangfire正在尝试拾取Elmah日志以记录Hangfire作业的执行过程。如果您查看Elmah配置并检查是否有<logger name="*" minlevel="Trace" writeTo="network" />之类的内容 - 此处而不是*您可以指定应用程序的Elmah记录器名称,以便Hangfire无法使用此功能。此解决方案是为了避免Hangfire记录到与应用程序相关的日志。

但是,如果您希望解决所面临的问题,请检查ELmah配置并查看是否正确设置了所需的连接字符串。

答案 1 :(得分:0)

事实证明错误信息与hangfire无关。我只是在网络配置中没有Elmah的连接字符串。

相关问题