【发布时间】:2015-07-17 01:17:27
【问题描述】:
我在尝试呈现 elmah 错误日志和使用 SQL DB 时收到错误消息。 "http://localhost:5525/elmah" [ArgumentNullException:值不能为空。 参数名称:id] c:\builds\ELMAH-1.2-SP2\src\Elmah\ErrorLogEntry.cs:57 中的 Elmah.ErrorLogEntry..ctor(ErrorLog 日志,字符串 id,错误错误) Elmah.SqlErrorLog.ErrorsXmlToList(XmlReader reader, IList errorEntryList) 在 c:\builds\ELMAH-1.2-SP2\src\Elmah\SqlErrorLog.cs:365 Elmah.SqlErrorLog.ErrorsXmlToList(String xml, IList errorEntryList) 在 c:\builds\ELMAH-1.2-SP2\src\Elmah\SqlErrorLog.cs:332 c:\builds\ELMAH-1.2-SP2\src\Elmah\SqlErrorLog.cs:186 中的 Elmah.SqlErrorLog.GetErrors(Int32 pageIndex, Int32 pageSize, IList errorEntryList) c:\builds\ELMAH-1.2-SP2\src\Elmah\ErrorLogPage.cs:76 中的 Elmah.ErrorLogPage.OnLoad(EventArgs e) System.Web.UI.Control.LoadRecursive() +54 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
我有最新的 Core Elmah 1.2-SP2 和最新的 Elmah.MVC 2.1.2。我使用默认的 web.config 设置安装了 Nuget 包 Elmah.MVC。
当我将 web.config 配置为将错误记录到数据库时,错误会记录在数据库中,但我无法呈现错误页面。当我不配置数据库时,elmah 页面呈现得很好。
<elmah>
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="Company" />
</elmah>
反编译 Elmah 我在引发参数的构造函数中看到。
if (id == null)
throw new ArgumentNullException("id");
if (id.Length == 0)
throw new ArgumentException((string) null, "id");
我在数据库中的所有 ErrorId 都是填充的 GUID。
我很困惑什么 id 没有被传递给核心 elmah。有没有人遇到过这个?
【问题讨论】:
标签: sql-server asp.net-mvc-5 elmah elmah.mvc