错误:无法加载log4net的集会 [英] Error: Could not load log4net assembly

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

问题描述

我期待解决这个错误:


  

无法加载文件或程序集log4net的,版本= 1.2.10.0,文化=中性公钥= 692fbea5521e1304'或它的一个依赖。该系统找不到指定的文件。此错误位于web.config文件。


当我复制log4net.dll我的web应用程序的bin目录中,我得到了


  

无法加载文件或程序集log4net的,版本= 1.2.10.0,文化=中性公钥= 692fbea5521e1304'或它的一个依赖。找到的程序集清单定义不匹配程序集引用。


此错误也发生在web.config文件。

这是很容易改变的版本和公钥标记的文件,以便装配负载正确匹配。当我这样做,我的网站运行完美,除了当的ReportViewer 对象初始化。然后,它抛出原来的错误在标签的ReportViewer,而不是web.config中。

我的假设是,如果我安装 log4net.dll 的请求的版本,我的问题都将迎刃而解。但我不知道该文件,或在哪里可以找到它。我已经通过下载log4net的1.2.10和尝试在下载每个DLL检查明显。

我要指出,该网站运行没有我的开发机器上的问题,而不是在发布到我的服务器。

我运行一个asp.net网站,.NET 4.0,IIS 7,Server 2008 R2的操作系统。我已经安装了64位的Crystal Reports 13.0.1(我的机器是64位)。

我怎样才能解决这个问题?

编辑:
为了响应@ Kevian的回答,我已经做了改变我的web.config文件。我仍然得到那里的清单定义不匹配的程序集引用的错误。在code抛出这个错误是:

  33号线:其中,CR:ID的CrystalReportViewer =CrystalReportViewer1=服务器AutoDataBind =真
第34行:BestFitPage =真ToolPanelView =无/>


解决方案

有在这里玩了几个问题,可解析:


  1. 作为log4net.dll冲突与水晶报表中使用的的32位版本的公钥标记。要验证,如果你有这个问题,做一搜 692fbea5521e1304 在所有的.csproj文件 - 如果你看到CrystalDecisions log4net的你有这个问题。

  2. log4net.dll冲突的 32位版本的DLL被编译为64位或值为anycpu架构。如果你有这样的问题,你会发现,像下面的引用。您可以通过重新配置你的应用程序池为32位运行,并检查是否应用程序运行验证问题 - 如果这样做,你有这个问题


 <参考包括=log4net的,版本= 1.2.10.0,文化=中立,


  
  

公钥= 692fbea5521e1304 的ProcessorArchitecture = 86 >


在64位的为我们工作的修复是让这实际上有一个新的公钥最新log4net.dll,更换log4net.dll在第三方bin文件夹,更改所有log4net.dll引用看起来像这样:


 <参考包括=log4net的,版本= 1.2.10.0,文化=中立,


  
  

公钥= 1b44e1d426115821 的ProcessorArchitecture = MSIL >


I am looking to solve this error:

Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified." This error is located in the web.config file.

When I copy log4net.dll to the bin directory of my webapp, I get a

Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

This error also occurs in the web.config file.

It's easy enough to change the version and the public key token to match the file so that the assembly loads correctly. When I do that, my website runs perfectly, except for when a reportViewer object is initialized. Then it throws the original error at the reportViewer tag, not the web.config.

My hypothesis is that if I install the requested version of log4net.dll, my problems will be solved. But I have no clue which file that it, or where to find it. I've checked the obvious by downloading log4net 1.2.10 and trying out every dll in the download.

I should mention that the website runs without issues on my development machine, but not when published to my server.

I'm running an asp.net website, .NET 4.0, IIS 7, on a Server 2008 R2 OS. I've installed Crystal Reports 13.0.1 for 64bit (my machine is 64bit).

How can I resolve this issue?

EDIT: In response to @Kevian's answer, I have made the change to my web.config file. I still get the error where the manifest definition doesn't match the assembly reference. The code that throws this error is:

Line 33:     <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server"   AutoDataBind="true"
Line 34:         BestFitPage="True" ToolPanelView="None" />

解决方案

There are a couple of issues at play here that are resolvable:

  1. The public key token for the 32bit version of log4net.dll clashes with the one used by Crystal Reports. To verify if you have this problem, do a search for "692fbea5521e1304" in all of your .csproj files - if you see references to CrystalDecisions AND log4net you have this problem.
  2. The 32bit version of log4net.dll clashes with dlls that are compiled for 64-bit or AnyCPU architecture. If you have this problem, you will find the references that look like below. You can verify the problem by reconfiguring your application pool to run as 32bit and checking to see if the app runs - if it does, you have this problem.

<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, 

PublicKeyToken=692fbea5521e1304, processorArchitecture=x86" >

The Fix that worked for us in 64-bit was to get the latest log4net.dll which actually has a new PublicKeyToken, replace the log4net.dll in your 3rd party bin folder, AND change all of the log4net.dll references to look like so:

<Reference Include="log4net, Version=1.2.10.0, Culture=neutral,

PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">

这篇关于错误:无法加载log4net的集会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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