无法加载文件或程序集'log4net'或它的一个依赖关系
我正在尝试创建一个水晶报告,并且我是该领域的新成员。我从this tutorial post创建了一份水晶报告,但似乎并不奏效。无法加载文件或程序集'log4net'或它的一个依赖关系
我的错误是:
Could not load file or assembly 'log4net' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.BadImageFormatException: Could not load file or assembly 'log4net' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'log4net' could not be loaded.
BadFormatImageException是当您的程序编译为32位体系结构并尝试加载64位库或反之亦然时收到的错误。从错误中,您可以参考log4net(一个众所周知的日志库)。
首先,检查什么样的你创建你的应用程序(X86,X64 AnyCPU)
二,检查的log4net的位元CPU的(你应该引用您的应用程序相同的位数)
三,检查什么操作系统IIS正在运行。 (如果是x64和您的应用程序32,请在应用程序池的高级设置部分中将“启用32位应用程序”设置为true)
“试图加载程序格式不正确。”可能是因为你的一些DLL有32位,有些是64位。另一个原因可能是您的应用程序服务器配置为64位,dll为32位(或其他方式)。
我会先检查IIS的设置(这取决于您使用的IIS版本),然后检查是否将dll编译为32位或64位(来自myproject设置)。
您是否在计算机上安装了log4net? – ChrisF 2012-03-15 21:56:39
您的问题是与log4net,而不是水晶报表。你是否添加了对log4net dll的引用? – 2012-03-15 21:57:09
不,我没有,我不知道该怎么做,请你帮帮我。谢谢 – emilios 2012-03-15 21:58:49