NLog and SQLite Error

南笙酒味 提交于 2019-12-13 02:17:35

问题


I am trying to get NLog to properly log to a SQLite database.
I am able to interact with the SQLite database aside from NLog.

When I force Internal Logging of NLog, I see the following error:

Error initializing target Database Target[db] System.TypeLoadException: Could not load type 'System.Data.SQLite' from assembly 'NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c'.

My NLog configuration has the following parameters:

  • dbProvider="System.Data.SQLite" keepConnection="false"
  • connectionString="Data Source=${basedir}\Database.s3db;"
  • commandText="INSERT into Log(Timestamp, Loglevel, Logger, Callsite, Message) values(@Timestamp, @Loglevel, @Logger, @Callsite, @Message)"

What am I missing?


回答1:


I changed the NLog configuration to point to System.Data.SQLite.EF6 as the dbProvider and it is working now.



来源:https://stackoverflow.com/questions/30795017/nlog-and-sqlite-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!