替换umbraco TinyMCE拼写检查器导致log4net问题

时间:2013-09-23 20:53:13

标签: tinymce log4net umbraco spell-checking hunspell

我想解决umbraco中TinyMCE拼写检查器的一个已知问题:http://issues.umbraco.org/issue/U4-2060

尝试安装推荐的替代解决方案HunSpellChecker(http://our.umbraco.org/projects/backoffice-extensions/hunspellchecker)。我完全试图使用它时得到一个不同的错误:

<html> <head> <title>Could not load file or assembly 'log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.</title> <meta name="viewport" content="width=device-width" /> <style> body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } @media screen and (max-width: 639px) { pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; } } @media screen and (max-width: 479px) { pre { width: 280px; } } </style> </head> <body bgcolor="white"> <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1> <h2> <i>Could not load file or assembly 'log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.</i> </h2></span> <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "> <b> Description: </b>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. <br><br> <b> Exception Details: </b>System.IO.FileNotFoundException: Could not load file or assembly 'log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.<br><br> <b>Source Error:</b> <br><br> <table width=100% bgcolor="#ffffcc"> <tr> <td> <code> An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code> </td> </tr> </table> <br> <b>Assembly Load Trace:</b> The following information can be helpful to determine why the assembly 'log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=null' could not be loaded.<br><br> <table width=100% bgcolor="#ffffcc"> <tr> <td> <code><pre> WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. </pre></code> </td> </tr> </table> <br> <b>Stack Trace:</b> <br><br> <table width=100% bgcolor="#ffffcc"> <tr> <td> <code><pre> [FileNotFoundException: Could not load file or assembly &#39;log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=null&#39; or one of its dependencies. The system cannot find the file specified.] Usc.Plugins.HunSpellChecker.HunSpellChecker..cctor() +0 [TypeInitializationException: The type initializer for &#39;Usc.Plugins.HunSpellChecker.HunSpellChecker&#39; threw an exception.] Usc.Plugins.HunSpellChecker.HunSpellChecker..ctor() +0 [TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean&amp; canBeCached, RuntimeMethodHandleInternal&amp; ctor, Boolean&amp; bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark&amp; stackMark) +113 System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark&amp; stackMark) +232 System.Activator.CreateInstance(Type type, Boolean nonPublic) +83 System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark&amp; stackMark) +1136 System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +128 System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +18 System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +60 System.Web.Configuration.HandlerFactoryCache..ctor(String type) +46 System.Web.HttpApplication.GetFactory(String type) +86 System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +262 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +155 </pre></code> </td> </tr> </table> <br> <hr width=100% size=1 color=silver> <b>Version Information:</b>&nbsp;Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18045 </font> </body> </html> <!-- [FileNotFoundException]: Could not load file or assembly &#39;log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=null&#39; or one of its dependencies. The system cannot find the file specified. at Usc.Plugins.HunSpellChecker.HunSpellChecker..cctor() [TypeInitializationException]: The type initializer for &#39;Usc.Plugins.HunSpellChecker.HunSpellChecker&#39; threw an exception. at Usc.Plugins.HunSpellChecker.HunSpellChecker..ctor() [TargetInvocationException]: Exception has been thrown by the target of an invocation. at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) at System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) at System.Web.Configuration.HandlerFactoryCache..ctor(String type) at System.Web.HttpApplication.GetFactory(String type) at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) -->

我安装了0.2.0版本的hunspellchecker,因为这个站点正在运行umbraco 4.7.1我试图找到并安装一个log4net包,错误信息类似但第二句话稍有改动:找到了程序集的清单定义与装配参考不匹配。

我相信在某处可能存在对1.2.11.0的引用,我需要将其更改为1.2.10.0但我没有看到任何此类引用发生的位置。

我必须更改什么才能正确加载log4net?

1 个答案:

答案 0 :(得分:0)

我猜它的版本是1.2.11.0,因为这是与Umbraco的更高版本一起发布的版本 - 而且是插件的构建版本。

您可以尝试从更高版本的Umbraco获取1.2.11.0 DLL并使用它。我怀疑与使用更高版本的兼容性会出现问题吗?

或者,您可以尝试在web.config文件中进行绑定重定向。例如我想你需要像

这样的东西

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

  <dependentAssembly>

    <assemblyIdentity name="log4net" publicKeyToken="" />

    <bindingRedirect oldVersion="1.2.0.0-1.3.0.0" newVersion="1.2.10.0" />

  </dependentAssembly>

(我使用免费的JetBrains DotPeek找到了publicKeyToken,它说它为null - 所以我假设“”会这样做吗?)