log4net 无法加载类型 AdoNetAppender

发布于 2024-10-30 19:26:00 字数 455 浏览 0 评论 0原文

我已经配置了一个简单的控制台应用程序来与 log4net 一起使用。我能够成功让 log4net 写入日志文件;但是,当我尝试写入数据库时​​,它抛出异常。我得到以下信息:

System.TypeLoadException:无法加载类型 [log4net.Appender.AdoNetAppender]。尝试组装[log4net, 版本=1.2.10.0,文化=中性,PublicKeyToken=1b44 e1d426115821] 和所有加载的程序集

我首先前往 dll 来检查可用的附加程序,而 AdoNetAppender 不在那里,因此无法加载它是有道理的。我认为这可能是我从 Apache 下载的 dll 的问题,所以我去 SourceForge 获取了旧版本...当我检查该 dll 时,它也没有 AdoNetAppender!我无法想象这有那么困难。我错过了一些明显的东西吗?

I've configured a simple console app to work with log4net. I was able to successfully get log4net to write to a log file; however, it's throwing an exception when I try to write to the database. I get the following:

System.TypeLoadException: Could not load type
[log4net.Appender.AdoNetAppender]. Tried assembly [log4net,
Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44 e1d426115821]
and all loaded assemblies

I went first to the dll to check out the available appenders, and AdoNetAppender isn't there, so it would make sense that it couldn't be loaded. I thought this might be a problem with the dll I downloaded from Apache, so I went to SourceForge to get an older copy... and when I checked that dll, it didn't have AdoNetAppender either! I can't imagine this is that difficult. Am I missing something obvious?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小猫一只 2024-11-06 19:26:00

我遇到了 log4net 和 AdoNetAppender 的问题,只有当 System.Data.dll 与 log4net DLL 一起存在于 bin 目录中时,它才会写入数据库。如果您还没有解决这个问题,那么值得尝试一下。

I've got an issue with log4net and the AdoNetAppender whereby it'll only write to the DB if System.Data.dll is present in the bin directory along with the log4net DLL. It's worth trying this if you haven't already solved this problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文