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



我在我托管应用程序的服务器上的最后两天收到了这个错误。

我已经尝试了这里提到的大部分场景。但什么都没得到。

这是我的堆栈跟踪-

[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位上运行。

我遇到过这个问题,为我解决这个问题的是转到程序属性(在Project->"program Name"properties下),然后在发布区域下,找到应用程序文件,并找到Log4net.dll。

对我来说,这被设置为"包括(自动)",但实际上并没有将其包括在程序中。当我将其设置为"Include"时,它为我解决了这个问题。

您的bin目录中缺少log4net.dll或版本不同于version=1.1.2.10.0。请确保打包了正确的log4net.dll(版本)。或者,如果您的项目中有多个版本,您可以尝试重新绑定这些版本。

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

对我来说,log4net文件在那里,版本正确,但问题是缺少运行时。已在此处下载:https://www.tektutorialshub.com/crystal-reports/how-to-download-and-install-crystal-report-runtime/

相关内容

最新更新