无法加载文件或程序集“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.

查看:113
本文介绍了无法加载文件或程序集“log4net”或其依赖项之一。尝试加载格式不正确的程序。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

某些背景...

我的网络服务器正在运行Windows Server 2008 R2(x64)。 我的开发机器运行的是Windows 7(x86)。 以前,我使用的是Visual Studio 2008和Crystal Reports for VS 2008.  CR x64运行时已安装在服务器上。 
所有已发布和正常工作。

My web server is running Windows Server 2008 R2 (x64).  My development machine is running Windows 7 (x86).  Previously, I was using Visual Studio 2008 - and Crystal Reports for VS 2008.  The CR x64 runtime was installed on the server.  Everything published and worked fine.

我最近升级到Visual Studio 2010 - 和Crystal Reports for VS 2010. 我在服务器上安装了新的运行时。 发布升级后的项目后,我收到此错误:

I recently upgraded to Visual Studio 2010 - and Crystal Reports for VS 2010.  I installed the new runtime on the server.  After publishing the upgraded project, I get this error:

是的,我为任何CPU编译......之前没有问题,所以我不知道我认为现在应该是一个问题。 此外,我的项目没有直接引用log4net(但它最终会在bin中)。 我已确保所有Crystal Reports
引用都具有"Copy Local";设置为false。

Yes, I compile for Any CPU... it wasn't a problem before, so I don't think it should be a problem now.  Furthermore, log4net is not directly referenced by my project (yet it does end up in the bin).  I have made sure that all of the Crystal Reports references have "Copy Local" set to false.

作为一种解决方法,如果我在网站发布后从服务器上的bin目录中删除log4net.dll - 一切正常。 如果解决方案只是为了防止log4net被复制 - 我会好的...告诉我如何:)

As a workaround, if I delete the log4net.dll from the bin directory on the server after the site is published - everything works fine.  If the solution was just to prevent log4net from being copied - I'd be ok with that... just tell me how :)

其他论坛上有几个类似的log4net问题 - 我已阅读它们,但尚未找到解决方案。

There are several similar log4net issues on other forums - I have read them, and haven't found a solution.

推荐答案

您好,

参见此
SAP Crystal Reports
论坛帖子提供解决方案。

See this SAP Crystal Reports forum post for a solution.

我们发现您必须为x86或x64设置项目,而不是两者都设置。安装程序会检测操作系统和硬件支持的内容,并且只安装x64运行时。如果您的应用程序池在x86中运行,这将导致问题,因此建议您为特定位版本构建

We have discovered that you must set your project for either x86 or x64, not both. The install detects what the OS and hardware support and simply installs the x64 runtime only. If you app pool is running in as x86 this is going to cause problems so it's recommended you build for specific bit versions.

该链接还链接到一些Microsoft文章为什么......

The link also links to a few Microsoft articles on why...

谢谢


这篇关于无法加载文件或程序集“log4net”或其依赖项之一。尝试加载格式不正确的程序。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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