NLog 和 SQLite 错误 [英] NLog and SQLite Error

查看:55
本文介绍了NLog 和 SQLite 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让 NLog 正确登录到 SQLite 数据库.
除了 NLog 之外,我还可以与 SQLite 数据库进行交互.

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.

当我强制对 NLog 进行内部日志记录时,我看到以下错误:

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

初始化目标数据库目标时出错[db] System.TypeLoadException:无法从程序集NLog,版本=4.0.0.0,Culture=neutral,PublicKeyToken=5120e14c03d0593c"加载类型System.Data.SQLite".

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'.

我的 NLog 配置有以下参数:

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,消息)值(@Timestamp、@Loglevel、@Logger、@Callsite、@Message)"

我错过了什么?

推荐答案

我将 NLog 配置更改为指向 System.Data.SQLite.EF6 作为 dbProvider,现在它正在工作.

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

这篇关于NLog 和 SQLite 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆