Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

weird log4net reference error on initial load after deployment [duplicate]

I am getting the attached error, ever since I put the latest version of log4net (1.2.11.0) on my solution projects. This happens on server right after I deploy, and when I refresh again it just disappears until next deployment. Please notice that I've tried the following version redirection code, but it did not help:

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
        <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
        <bindingRedirect oldVersion="1.2.10.0" newVersion="1.2.11.0" />
    </dependentAssembly>
</assemblyBinding>

This is the error I am getting:

Server Error in '/' Application.

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

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

Source Error:

 Line 76:     </script>
Line 77:     <form id="form1" runat="server">
Line 78:     <asp:ScriptManager ID="radscriptmanager" runat="server">
Line 79:     </asp:ScriptManager>
Line 80:     <asp:ContentPlaceHolder ID="cphAfterScriptManager" runat="server">

Source File: MainFront.Master Line: 78

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

like image 838
Sagi Avatar asked Jul 26 '12 09:07

Sagi


1 Answers

I suspect the reason for this could be that you've got dependencies on 1.2.10 in your application and the new version you've installed of log4net is not compatible due to the new signing key.

1.2.11 you'll notice has been signed with a different key which has caused pain for many people. I ended up just reverting back to 1.2.10.

However there is a version of 1.2.11 that has carried on with previous key. Just download that and do the following and all should be okay.

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="log4net" publicKeyToken="1b44e1d426115821" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-1.2.10.0"
                             newVersion="1.2.11.0"/>
        </dependentAssembly>
    </assemblyBinding>
</runtime>

You can get the new and old key from the following url: http://logging.apache.org/log4net/download_log4net.cgi

like image 63
Ryan Avatar answered Nov 08 '22 06:11

Ryan