问题
I am getting this error since last 2 days in my Server where i had hosted application. I had already tried most of the scenario mentioned here. but not getting anything.
Here is my stack trace -
[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) +184Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
Already configured my IIS to allow applications to run on 32bit.
回答1:
I have had this issue, and what fixed it for me was going to the program properties (under Project -> "Program Name" Properties) and then under the publish area, find the Application Files, and find the Log4net.dll.
This was set to "Include(Auto)" for me, but that did not actually include it in the Program. when i set this to "Include" That fixed that issue for me.
回答2:
You are missing the log4net.dll or have a different version than Version=1.2.10.0 in your bin directory. Make sure you package the right log4net.dll (version). Or if you have multiple versions in your project you can try to rebind the versions.
来源:https://stackoverflow.com/questions/36615516/could-not-load-file-or-assembly-log4net-version-1-2-10-0-culture-neutral-pub