部署后初始加载时出现奇怪的log4net参考错误 [英] weird log4net reference error on initial load after deployment

查看:99
本文介绍了部署后初始加载时出现奇怪的log4net参考错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从将最新版本的log4net(1.2.11.0)放到我的解决方案项目中以来,我就收到了附件错误. 这种情况是在我部署后立即在服务器上发生的,当我再次刷新时,它会消失直到下一次部署.请注意,我已经尝试了以下版本重定向代码,但没有帮助:

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>

这是我得到的错误:

"/"应用程序中的服务器错误.

Server Error in '/' Application.

无法加载文件或程序集'log4net,版本= 1.2.10.0,区域性=中性,PublicKeyToken = 1b44e1d426115821'或其依赖项之一.找到的程序集的清单定义与程序集引用不匹配. (来自HRESULT的异常:0x80131040)

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)

异常详细信息:System.IO.FileLoadException:无法加载文件或程序集'log4net,版本= 1.2.10.0,区域性=中性,PublicKeyToken = 1b44e1d426115821'或其依赖项之一.找到的程序集的清单定义与程序集引用不匹配. (来自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)

源错误:

 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">

源文件:MainFront.Master行:78

Source File: MainFront.Master Line: 78

程序集加载跟踪:以下信息有助于确定为何无法加载程序集'log4net,版本= 1.2.10.0,文化=中性,PublicKeyToken = 1b44e1d426115821'.

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.

推荐答案

我怀疑这可能是由于您的应用程序对1.2.10有依赖性,而您安装的log4net的新版本却没有由于新的签名密钥而兼容.

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您会注意到使用不同的密钥进行了签名,这使许多人感到痛苦.我最终只是恢复到1.2.10.

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.

但是,使用先前的密钥进行的版本为1.2.11.只需下载该文件,然后执行以下操作,就可以了.

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>

您可以从以下网址获取新的和旧的密钥: http://logging.apache.org/log4net/download_log4net.cgi

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

这篇关于部署后初始加载时出现奇怪的log4net参考错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆