简体   繁体   English

log4net 没有记录并抛出错误

[英]log4net not logging and throwing error

I have been using log4Net to write in a text file when there is any exception in my web service, this was working but today it started to throw error.当我的 web 服务出现任何异常时,我一直在使用 log4Net 写入文本文件,这可以正常工作,但今天它开始抛出错误。

 System.Web.Services.Protocols.SoapException: Server was unable to

process request.处理请求。 ---> System.TypeInitializationException: The type initializer for.. threw an exception. ---> System.TypeInitializationException: 的类型初始化器.. 引发了异常。 ---> System.IO.FileLoadException: Could not load file or assembly 'log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905' or one of its dependencies. ---> System.IO.FileLoadException:无法加载文件或程序集“log4net,版本=1.2.9.0,文化=中性,PublicKeyToken=b32731d11ce58905”或其依赖项之一。 The located assembly's manifest definition does not match the assembly reference.找到的程序集的清单定义与程序集引用不匹配。 (Exception from HRESULT: 0x80131040) File name: 'log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905' (HRESULT 异常:0x80131040)文件名:'log4net,版本 = 1.2.9.0,文化 = 中性,PublicKeyToken = b32731d11ce58905'

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

If you have any inputs on this stack info, pls.如果您对此堆栈信息有任何输入,请。 share it.分享它。

Did you change the code, or did this just start happening?您是否更改了代码,还是刚刚开始发生这种情况?

I've seen this error occur when the target processor architecture was mismatched.我已经看到当目标处理器架构不匹配时会发生此错误。 Did you change that by any chance?你有没有改变它?

If this isn't the case, and you have Windows SDK installed, you can use the Fusion Log Viewer to view assembly binding logs.如果不是这种情况,并且您安装了 Windows SDK,则可以使用 Fusion Log Viewer 查看程序集绑定日志。 The utility should be installed on your machine.该实用程序应安装在您的计算机上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM