log4net not found issue in .NET framework 4.8

I am working on a .NET Framework 4.8 project. Previously it was designed for .NET Framework 3 and Visual Studio 2008. During this upgrade, I installed the latest version of Crystal Reports and Visual Studio because it was giving issue on old version of Crystal Reports in Visual Studio 2022. Now it’s showing new error that log4net is not loading but I checked I can see that file.

These are the errors:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileLoadException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source Error:
Line 13: <div style="width:55%">
Line 14:
Line 15: <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server"
Line 16: AutoDataBind="true" />
Line 17: <CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
Source File: d:xxxxxxxxReportsShowReport.aspx Line: 15
Assembly Load Trace: The following information can be helpful to determine why the assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' could not be loaded.
Assembly manager loaded from: C:WindowsMicrosoft.NETFramework64v4.0.30319clr.dll
Running under executable C:Program FilesIIS Expressiisexpress.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304
(Fully-specified)
LOG: Appbase = file:///D:/xxxxx/xxxx/
LOG: Initial PrivatePath = D:xxxxxxxxxxbin
Calling assembly : CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:xxxxxxxxweb.config
LOG: Using host configuration file: C:UsersxxxxDocumentsIISExpressconfigaspnet.config
LOG: Using machine configuration file from C:WindowsMicrosoft.NETFramework64v4.0.30319configmachine.config.
LOG: Post-policy reference: log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304
LOG: Attempting download of new URL file:///C:/Users/xxxxx/AppData/Local/Temp/Temporary ASP.NET Files/vs/96a8c422/6d872058/log4net.DLL.
LOG: Attempting download of new URL file:///C:/Users/xxxxx/AppData/Local/Temp/Temporary ASP.NET Files/vs/96a8c422/6d872058/log4net/log4net.DLL.
LOG: Attempting download of new URL file:///D:/xxxxx/xxxx/bin/log4net.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Stack Trace:
[FileLoadException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
CrystalDecisions.Web.CrystalReportViewer..cctor() +0
[TypeInitializationException: The type initializer for 'CrystalDecisions.Web.CrystalReportViewer' threw an exception.]
CrystalDecisions.Web.CrystalReportViewer..ctor() +0
ASP.reports_showreport_aspx.__BuildControlCrystalReportViewer1() in d:xxxxxxxxxxReportsShowReport.aspx:15
ASP.reports_showreport_aspx.__BuildControlform1() in d:xxxxxxxxReportsShowReport.aspx:12
ASP.reports_showreport_aspx.__BuildControlTree(reports_showreport_aspx __ctrl) in d:Ascent-SCMSMART.WebsiteReportsShowReport.aspx:1
ASP.reports_showreport_aspx.FrameworkInitialize() in c:UsersxxxAppDataLocalTempTemporary ASP.NET Filesvs96a8c4226d872058App_Web_ieb0u1kl.1.cs:0
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +52
System.Web.UI.Page.ProcessRequest() +79
System.Web.UI.Page.ProcessRequest(HttpContext context) +74
ASP.reports_showreport_aspx.ProcessRequest(HttpContext context) in c:UsersxxxxAppDataLocalTempTemporary ASP.NET Filesvs96a8c4226d872058App_Web_ieb0u1kl.1.cs:0
System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +2153
[HttpException (0x80004005): Error executing child request for /Reports/ShowReport.aspx.]
System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, yStringOveVirtualPath path, VirtualPath filePath, String physPath, Exception error, String querrride) +2414
System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm) +848
System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm) +74
SMART.Website.Reports.Search.RequirementSearch.ShowDetailsOfPO() in D:xxxxxxxReportsSearchRequirementSearch.aspx.cs:297
SMART.Website.Reports.Search.RequirementSearch.po_content_Click(Object sender, CommandEventArgs e) in D:xxxxxxReportsSearchRequirementSearch.aspx.cs:283
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +139
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1959
</code>
<code>Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IO.FileLoadException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) Source Error: Line 13: <div style="width:55%"> Line 14: Line 15: <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" Line 16: AutoDataBind="true" /> Line 17: <CR:CrystalReportSource ID="CrystalReportSource1" runat="server"> Source File: d:xxxxxxxxReportsShowReport.aspx Line: 15 Assembly Load Trace: The following information can be helpful to determine why the assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' could not be loaded. Assembly manager loaded from: C:WindowsMicrosoft.NETFramework64v4.0.30319clr.dll Running under executable C:Program FilesIIS Expressiisexpress.exe --- A detailed error log follows. === Pre-bind state information === LOG: DisplayName = log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304 (Fully-specified) LOG: Appbase = file:///D:/xxxxx/xxxx/ LOG: Initial PrivatePath = D:xxxxxxxxxxbin Calling assembly : CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304. === LOG: This bind starts in default load context. LOG: Using application configuration file: D:xxxxxxxxweb.config LOG: Using host configuration file: C:UsersxxxxDocumentsIISExpressconfigaspnet.config LOG: Using machine configuration file from C:WindowsMicrosoft.NETFramework64v4.0.30319configmachine.config. LOG: Post-policy reference: log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304 LOG: Attempting download of new URL file:///C:/Users/xxxxx/AppData/Local/Temp/Temporary ASP.NET Files/vs/96a8c422/6d872058/log4net.DLL. LOG: Attempting download of new URL file:///C:/Users/xxxxx/AppData/Local/Temp/Temporary ASP.NET Files/vs/96a8c422/6d872058/log4net/log4net.DLL. LOG: Attempting download of new URL file:///D:/xxxxx/xxxx/bin/log4net.DLL. WRN: Comparing the assembly name resulted in the mismatch: Major Version ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated. Stack Trace: [FileLoadException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)] CrystalDecisions.Web.CrystalReportViewer..cctor() +0 [TypeInitializationException: The type initializer for 'CrystalDecisions.Web.CrystalReportViewer' threw an exception.] CrystalDecisions.Web.CrystalReportViewer..ctor() +0 ASP.reports_showreport_aspx.__BuildControlCrystalReportViewer1() in d:xxxxxxxxxxReportsShowReport.aspx:15 ASP.reports_showreport_aspx.__BuildControlform1() in d:xxxxxxxxReportsShowReport.aspx:12 ASP.reports_showreport_aspx.__BuildControlTree(reports_showreport_aspx __ctrl) in d:Ascent-SCMSMART.WebsiteReportsShowReport.aspx:1 ASP.reports_showreport_aspx.FrameworkInitialize() in c:UsersxxxAppDataLocalTempTemporary ASP.NET Filesvs96a8c4226d872058App_Web_ieb0u1kl.1.cs:0 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +52 System.Web.UI.Page.ProcessRequest() +79 System.Web.UI.Page.ProcessRequest(HttpContext context) +74 ASP.reports_showreport_aspx.ProcessRequest(HttpContext context) in c:UsersxxxxAppDataLocalTempTemporary ASP.NET Filesvs96a8c4226d872058App_Web_ieb0u1kl.1.cs:0 System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +2153 [HttpException (0x80004005): Error executing child request for /Reports/ShowReport.aspx.] System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, yStringOveVirtualPath path, VirtualPath filePath, String physPath, Exception error, String querrride) +2414 System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm) +848 System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm) +74 SMART.Website.Reports.Search.RequirementSearch.ShowDetailsOfPO() in D:xxxxxxxReportsSearchRequirementSearch.aspx.cs:297 SMART.Website.Reports.Search.RequirementSearch.po_content_Click(Object sender, CommandEventArgs e) in D:xxxxxxReportsSearchRequirementSearch.aspx.cs:283 System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +139 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1959 </code>
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Source Error:


Line 13:     <div style="width:55%">
Line 14:     
Line 15:         <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" 
Line 16:             AutoDataBind="true" />
Line 17:         <CR:CrystalReportSource ID="CrystalReportSource1" runat="server">

Source File: d:xxxxxxxxReportsShowReport.aspx    Line: 15

Assembly Load Trace: The following information can be helpful to determine why the assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' could not be loaded.


Assembly manager loaded from:  C:WindowsMicrosoft.NETFramework64v4.0.30319clr.dll
Running under executable  C:Program FilesIIS Expressiisexpress.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304
 (Fully-specified)
LOG: Appbase = file:///D:/xxxxx/xxxx/
LOG: Initial PrivatePath = D:xxxxxxxxxxbin
Calling assembly : CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:xxxxxxxxweb.config
LOG: Using host configuration file: C:UsersxxxxDocumentsIISExpressconfigaspnet.config
LOG: Using machine configuration file from C:WindowsMicrosoft.NETFramework64v4.0.30319configmachine.config.
LOG: Post-policy reference: log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304
LOG: Attempting download of new URL file:///C:/Users/xxxxx/AppData/Local/Temp/Temporary ASP.NET Files/vs/96a8c422/6d872058/log4net.DLL.
LOG: Attempting download of new URL file:///C:/Users/xxxxx/AppData/Local/Temp/Temporary ASP.NET Files/vs/96a8c422/6d872058/log4net/log4net.DLL.
LOG: Attempting download of new URL file:///D:/xxxxx/xxxx/bin/log4net.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

Stack Trace:

[FileLoadException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
   CrystalDecisions.Web.CrystalReportViewer..cctor() +0

[TypeInitializationException: The type initializer for 'CrystalDecisions.Web.CrystalReportViewer' threw an exception.]
   CrystalDecisions.Web.CrystalReportViewer..ctor() +0
   ASP.reports_showreport_aspx.__BuildControlCrystalReportViewer1() in d:xxxxxxxxxxReportsShowReport.aspx:15
   ASP.reports_showreport_aspx.__BuildControlform1() in d:xxxxxxxxReportsShowReport.aspx:12
   ASP.reports_showreport_aspx.__BuildControlTree(reports_showreport_aspx __ctrl) in d:Ascent-SCMSMART.WebsiteReportsShowReport.aspx:1
   ASP.reports_showreport_aspx.FrameworkInitialize() in c:UsersxxxAppDataLocalTempTemporary ASP.NET Filesvs96a8c4226d872058App_Web_ieb0u1kl.1.cs:0
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +52
   System.Web.UI.Page.ProcessRequest() +79
   System.Web.UI.Page.ProcessRequest(HttpContext context) +74
   ASP.reports_showreport_aspx.ProcessRequest(HttpContext context) in c:UsersxxxxAppDataLocalTempTemporary ASP.NET Filesvs96a8c4226d872058App_Web_ieb0u1kl.1.cs:0
   System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +2153

[HttpException (0x80004005): Error executing child request for /Reports/ShowReport.aspx.]
   System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, yStringOveVirtualPath path, VirtualPath filePath, String physPath, Exception error, String querrride) +2414
   System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm) +848
   System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm) +74
   SMART.Website.Reports.Search.RequirementSearch.ShowDetailsOfPO() in D:xxxxxxxReportsSearchRequirementSearch.aspx.cs:297
   SMART.Website.Reports.Search.RequirementSearch.po_content_Click(Object sender, CommandEventArgs e) in D:xxxxxxReportsSearchRequirementSearch.aspx.cs:283
   System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +139
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1959

I tried to overcome this error almost in every aspect. I saw solution in this platform and tried but didn’t get any success. I updated log4net into 2.0.17.0

Following solution that I tried so far.

  1. Update log4net and then clean solution and rebuild, but same error.

  2. Set binding redirect in web.config from log4net 1.2.10.0 to log4net 2.0.17.0. still same issue.

  3. Set location of folder in web.config like this:

    Plain text
    Copy to clipboard
    Open code in new window
    EnlighterJS 3 Syntax Highlighter
    <code><dependentAssembly>
    <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" />
    <codeBase version="2.0.17.0" href="D:xxxxxxxxbinDebuglog4net.dll" />
    </dependentAssembly>
    </code>
    <code><dependentAssembly> <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" /> <codeBase version="2.0.17.0" href="D:xxxxxxxxbinDebuglog4net.dll" /> </dependentAssembly> </code>
    <dependentAssembly>
        <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" />
     <codeBase version="2.0.17.0" href="D:xxxxxxxxbinDebuglog4net.dll" />
    </dependentAssembly>
    

    But the same error happens, nothing has changed.

  4. Change CPU setting into x86 or x64 and then clean solution and rebuild. In both cases also same error occurred.

I am not sure what else I need to do to resolve this error. It looks like I have to do it again from scratch.

Any help will be appreciated to resolve this issue.

Thanks

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật