【发布时间】:2019-07-08 20:53:40
【问题描述】:
我正在使用 Elmah 使用 SqlLite 数据库在 ASP.NET MVC 中记录未处理的异常。当我使用下面的 SqlLite 数据库配置 Elmah 时
<elmah>
<!--
See http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for
more information on remote access and securing ELMAH.
-->
<security allowRemoteAccess="false" />
<errorLog type="Elmah.SQLiteErrorLog, Elmah" connectionStringName="Elmah" />
</elmah>
使用下面的连接字符串
<connectionStrings>
<add name="Elmah" connectionString="data source=~/App_Data/Error.db" />
</connectionStrings>
它抛出这个异常
SQLiteException (0x1): SQL logic error
no such table: Error]
System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String strSql, SQLiteStatement previous, UInt32 timeoutMS, String& strRemain) +1239
System.Data.SQLite.SQLiteCommand.BuildNextCommand() +374
System.Data.SQLite.SQLiteCommand.GetStatement(Int32 index) +18
System.Data.SQLite.SQLiteDataReader.NextResult() +309
System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave) +266
System.Data.`enter code here`SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior) +45
System.Data.SQLite.SQLiteCommand.ExecuteReader() +21
Elmah.SQLiteErrorLog.GetErrors(Int32 pageIndex, Int32 pageSize, IList errorEntryList) +235
Elmah.ErrorLogPage.OnLoad(EventArgs e) +336
System.Web.UI.Control.LoadRecursive() +59
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678`
谁能告诉我哪里错了?
如何使用 Elmah 配置 SqlLite 数据库以进行日志记录?
【问题讨论】:
-
这里有同样的问题。我已经在本地成功配置了 elmah&sqlite,使用 Visual Studio 运行我的 wcf。当我发布到远程 IIS 服务器时(有些在这里挣扎link),它会抛出完全相同的错误。似乎我们有相同的 web.config,除了我在
<webServer>中有这个:<handlers> <add name="ELMAH" verb="POST,GET,HEAD" path="elmah/default.aspx" type="Elmah.ErrorLogPageFactory, Elmah"/> </handlers> <modules runAllManagedModulesForAllRequests="true"> <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/> </modules>
标签: c# asp.net-mvc sqlite elmah