Log4net.dll + C# + Crystal Reports = 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16776584/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Log4net.dll + C# + Crystal Reports = error
提问by RRM
Forgive me if it has been answered before but I searched the web and found only desperate people asking exactly my question but nobody giving any answer which I could use.
如果之前有人回答过,请原谅我,但我在网上搜索,发现只有绝望的人问我的问题,但没有人给出任何我可以使用的答案。
I'm developing an application in C# Visual Studio 2010 which uses Crystal Reports. I'm developing it on 32 bit system. Everything works okay.
我正在 C# Visual Studio 2010 中开发一个使用 Crystal Reports 的应用程序。我正在 32 位系统上开发它。一切正常。
Now I'm trying to run it on another computer which is 64 bit system has Crystal Reports installed and some terrible error happens.
现在我试图在另一台安装了 Crystal Reports 的 64 位系统计算机上运行它,但发生了一些可怕的错误。
************** Tekst wyj?tku **************
System.TypeInitializationException: Inicjator typów zg?osi? wyj?tek dla typu
'CrystalDecisions.ReportSource.ReportSourceFactory'. ---> System.TypeInitializationException:
Inicjator typów zg?osi? wyj?tek dla typu 'CrystalDecisions.Shared.SharedUtils'. --->
System.IO.FileLoadException: Nie mo?na za?adowa? pliku lub zestawu
'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' lub jednej z jego zale?no?ci.
Forgive me some Polish language there. It basically means that it cannot find some specific version of log4net.dll file which apparently must be used by something.
请原谅我在那里讲一些波兰语。这基本上意味着它无法找到某些特定版本的 log4net.dll 文件,而该文件显然必须被某些东西使用。
This problem was described in many places:
这个问题在很多地方都有描述:
log4net not logging and throwing error
http://scn.sap.com/thread/1857957
http://scn.sap.com/thread/1857957
I understand that my application uses/expects some version of this file and Crystal Reports installed on 64 bit machine uses another version.
我知道我的应用程序使用/期望此文件的某个版本,而安装在 64 位计算机上的 Crystal Reports 使用另一个版本。
Still after browsing the internet I have no idea what steps I should take to correct it.
浏览互联网后,我仍然不知道应该采取哪些步骤来纠正它。
I would be really grateful for some "tutorial for dummies" how to deal with it.
我会非常感谢一些“傻瓜教程”如何处理它。
Oh, and my application needs to be built as 32 bit and run on 64 bit. No possibility of building it as 64 bit, another thing would stop working :(
哦,我的应用程序需要构建为 32 位并在 64 位上运行。不可能将其构建为 64 位,另一件事将停止工作:(
回答by RRM
Well, not much response here :) I've learnt a few things myself since then and have thought I would share my knowledge with any poor beginner people that may encounter the similar problem.
好吧,这里没有太多回应:) 从那时起我自己学到了一些东西,并认为我会与任何可能遇到类似问题的可怜的初学者分享我的知识。
So there is something like GAC - http://en.wikipedia.org/wiki/Global_Assembly_CacheYou may think of it as a collection of libraries and drivers used by your programs.
所以有类似于 GAC 的东西 - http://en.wikipedia.org/wiki/Global_Assembly_Cache您可以将其视为您的程序使用的库和驱动程序的集合。
It is on your computer in c:/windows/assembly but it is a hidden directory so first you must enable seeing it.
它在您的计算机上的 c:/windows/assembly 中,但它是一个隐藏目录,因此首先您必须启用查看它。
At my 64 bit computer it contained GAC_32 and GAC_64 subdirectories. In GAC_64 there was log4net in:
在我的 64 位计算机上,它包含 GAC_32 和 GAC_64 子目录。在 GAC_64 中有 log4net:
c:\Windows\assembly\GAC_64\log4net.2.10.0__692fbea5521e1304\
In GAC_32 there was nothing. So I created the directory and copied the appropriate file from my 32 computer into it and it worked.
在 GAC_32 中什么都没有。因此,我创建了目录并将相应的文件从我的 32 台计算机复制到其中,并且它工作正常。
c:\Windows\assembly\GAC_32\log4net.2.10.0__692fbea5521e1304\
Still a moment later I faced another error but it is a different story
又过了一会儿,我又遇到了另一个错误,但这是一个不同的故事
CrystalDecisions.CrystalReports.Engine.ReportDocument'. ---> System.IO.FileNotFoundException: Nie mo?na za?adowa? pliku lub zestawu 'CrystalDecisions.ReportAppServer.CommLayer, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304
Generally expect that anything using Crystal Reports build on 32 bit computer may give problems when tried to run at 64 bit computer. SAP did really a crappy job with these drivers.
通常认为在 32 位计算机上使用 Crystal Reports 构建的任何内容在尝试在 64 位计算机上运行时都可能会出现问题。SAP 在这些驱动程序方面做得非常糟糕。
回答by Kinyanjui Kamau
回答by Jasmine John
回答by Dude76
Also, if you have installed only the 32bits version on a 64 bits platform, you'll get the same Log4net error; both version, 32 & 64 bits, are required.
另外,如果你在 64 位平台上只安装了 32 位版本,你会得到同样的 Log4net 错误;需要 32 位和 64 位版本。
It's curious that 64bits msi delploys DLL in SAP 32bits folder (C:\Program Files (x86)\BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet\ ) that 32bits setup doesn't.
奇怪的是,64 位 msi 在 SAP 32 位文件夹(C:\Program Files (x86)\BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet\ )中部署了 DLL,而 32 位设置没有.
回答by Jay
In my case, installing CR 64-bit wasn't an option, but I was able to work around this issue by enabling 32-bit application on the App Pool in IIS. (See this answer).
就我而言,安装 CR 64 位不是一个选项,但我能够通过在 IIS 中的应用程序池上启用 32 位应用程序来解决这个问题。(见这个答案)。

