无法加载文件或程序集'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304'或其依赖项之一。

3
我在过去的两天里在我的服务器上遇到了这个错误,我在那里托管了应用程序。
我已经尝试了这里提到的大部分情况,但是没有得到任何结果。
以下是我的堆栈跟踪 -
[FileNotFoundException: 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.]  
CrystalDecisions.Shared.SharedUtils..cctor() +0

[TypeInitializationException: The type initializer for
        'CrystalDecisions.Shared.SharedUtils' threw an exception.]   
CrystalDecisions.Shared.SharedUtils.get_CurrentControl() +18   
CrystalDecisions.Shared.SharedUtils.GetEffectiveCulture() +8   
CrystalDecisions.CrystalReports.Engine.CREngineRes.GetString(String name) +11   
CrystalDecisions.CrystalReports.Engine.ReportDocument.CheckForCrystalReportsRuntime() +143
CrystalDecisions.CrystalReports.Engine.ReportDocument..cctor() +131

[TypeInitializationException: The type initializer for
        'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception.]   
CrystalDecisions.CrystalReports.Engine.ReportDocument..ctor() +0
AdminReports..ctor() +25
ASP.reportviewer_aspx..ctor() +14
__ASP.FastObjectFactory_app_web_reportviewer_aspx_cdcab7d2.Create_ASP_reportviewer_aspx() +20 
System.Web.Compilation.BuildResultCompiledType.CreateInstance() +32
System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath
        virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp) +109   
System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType,
        VirtualPath virtualPath, String physicalPath) +31 
System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String requestType,
        String virtualPath, String path) +37   
System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +334
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.1
已经配置了我的IIS,允许32位应用程序运行。

看起来Crystal Reports依赖于log4net的1.2.10.0版本。你的应用程序使用的是1.2.10.0版本吗?还是使用了更新/更旧的版本? - thudbutt
4个回答

2

我遇到过这个问题,解决方法是进入程序属性(在项目->"程序名称" 属性下),然后在发布区域下找到“应用程序文件”,找到Log4net.dll。

对于我来说,这是设置为“包含(自动)”,但实际上并没有将其包含在程序中。当我将其设置为“包含”时,问题得到了解决。


0

你缺少log4net.dll文件,或者与bin目录中的Version=1.2.10.0版本不同。确保打包正确的log4net.dll(版本)。或者,如果项目中有多个版本,则可以尝试重新绑定版本。


0

0
  1. 在您的应用程序中验证DLL版本。如果版本错误,请使用NuGet获取正确的版本。
  2. 验证DLL属性“复制本地”设置为True
  3. 在项目属性下,将平台目标设置为x86。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接