Could not load file or assembly #39;log4net#39; or one of its dependencies(无法加载文件或程序集“log4net或其依赖项之一)
问题描述
我正在尝试创建一个水晶报表,但我是该领域的新手.我从 本教程帖子 但它似乎不起作用.
I am trying to create a crystal report and I am new to that field. I have created a crystal report from this tutorial post but it does not seems to work.
我的错误是:
无法加载文件或程序集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.
说明:在执行当前 Web 请求期间发生未处理的异常.请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息.
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.
异常详细信息:System.BadImageFormatException:无法加载文件或程序集log4net"或其依赖项之一.试图加载格式不正确的程序.
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.
来源错误:
在执行当前 Web 请求期间生成了未处理的异常.可以使用下面的异常堆栈跟踪来识别有关异常来源和位置的信息.
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.
程序集加载跟踪:以下信息有助于确定程序集log4net"无法加载的原因.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'log4net' could not be loaded.
推荐答案
BadFormatImageException 是当您的程序针对 32 位架构编译并尝试加载 64 位库时收到的错误,反之亦然.从错误中,您可以参考 log4net(一个众所周知的日志库).
首先,检查您正在创建应用程序的 CPU 类型(x86、x64、AnyCPU)
第二,检查 log4net 的位数(您应该引用相同的应用位数)
第三,检查 IIS 运行的是什么 OS.(如果是 x64 并且您的应用程序是 32,请在应用程序池的高级设置部分将启用 32 位应用程序"设置为 true)
BadFormatImageException is the error that you receive when your program is compiled for a 32bit architecture and will try to load a 64bit library or viceversa. From the error, you have a reference to log4net (a well known log library).
First, check for what kind of CPU you are creating your application (x86, x64, AnyCPU)
Second, check the bitness of log4net (You should reference the same bitness of your apps)
Third, check on what OS IIS is running. (if is x64 and your app 32, set 'Enable 32-bit Applications' to true in the advanced settings section of the application pool)
这篇关于无法加载文件或程序集“log4net"或其依赖项之一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:无法加载文件或程序集“log4net"或其依赖项之一
基础教程推荐
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- MS Visual Studio .NET 的替代品 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 将 XML 转换为通用列表 2022-01-01