Orchard CMS错误“ValueFactory试图访问此实例的Value属性”? [英] Orchard CMS Error “ValueFactory attempted to access the Value property of this instance”?

查看:353
本文介绍了Orchard CMS错误“ValueFactory试图访问此实例的Value属性”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用orchard 1.8.1并尝试安装主题Bootstrap,它给了我以下错误。请问有人帮我吗?



描述:执行当前Web请求时发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。



异常详细信息:System.InvalidOperationException:ValueFactory尝试访问此实例的Value属性。

 61  //  使用其他属性加载log4net线程如果可用 
62 protected internal void AddExtendedThreadInfo(){
Line 63 :< span class =code-keyword> if (_shellSettings.Value!= null ){
Line 64 :ThreadContext.Properties [ 租户] = _shellSettings.Value.Name ;
65 :}

解决方案

解决方案:最后很多搜索和尝试,只是发现它似乎工作,如果,在OrchardLog4netLogger.cs,我们取代

<前lang =c#> _ shellSettings = Lazy< shellsettings>(LoadSettings); < / shellsettings >



使用

 _ shellSettings =  new  Lazy< shellsettings>(LoadSettings,
System.Threading.LazyThreadSafetyMode.PublicationOnly); < / shellsettings >





然后,允许所有线程运行初始化方法。完成初始化的第一个线程设置Lazy< t>的值。实例


I I am using orchard 1.8.1 and try to install the theme Bootstrap and it gives me the following error. Can any one help me please?

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.InvalidOperationException: ValueFactory attempted to access the Value property of this instance.

Line 61:         // Load the log4net thread with additional properties if they are available
Line 62:         protected internal void AddExtendedThreadInfo() {
Line 63:             if (_shellSettings.Value != null) {
Line 64:                 ThreadContext.Properties["Tenant"] = _shellSettings.Value.Name;
Line 65:             }

解决方案

Solution : Finally after lots of search and tries, just found that it seems to work if, in OrchardLog4netLogger.cs, we replace

_shellSettings = new Lazy<shellsettings>(LoadSettings);</shellsettings>


With

_shellSettings = new Lazy<shellsettings>(LoadSettings,
     System.Threading.LazyThreadSafetyMode.PublicationOnly);</shellsettings>



Then, all threads are allowed to run the initialization method. The first thread to complete initialization sets the value of the Lazy<t> instance.


这篇关于Orchard CMS错误“ValueFactory试图访问此实例的Value属性”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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