果园CMS错误" ValueFactory试图访问这个实例和QUOT的Value属性;? [英] Orchard CMS Error "ValueFactory attempted to access the Value property of this instance"?

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

问题描述

我我使用的果园1.8.1,并尝试安装主题引导和它给了我以下错误。任何人都可以帮我吗?
说明:执行当前Web请求的执行过程中发生未处理的异常。请查看有关错误的详细信息的堆栈跟踪以及它起源于code。

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

  61号线://具有附加属性加载log4net的线程(如果有)
62号线:受保护的内部空间AddExtendedThreadInfo(){
63号线:如果(!_shellSettings.Value = NULL){
64号线:ThreadContext.Properties [房客] = _shellSettings.Value.Name;
65号线:}


解决方案

刚刚发现,它似乎工作,如果在OrchardLog4netLogger.cs,我们替换

  _shellSettings =新懒人< ShellSettings>(LoadSettings);

通过

  _shellSettings =新懒人< ShellSettings>(LoadSettings,
     System.Threading.LazyThreadSafetyMode.PublicationOnly);

然后,所有线程都可以运行初始化方法。第一个线程来完成初始化设置懒惰实例的值

I I am using orchard 1.8.1 and try to install the theme Bootstrap and it gives me the following errors. Can anyone help me out? 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:             }

解决方案

Just found that it seems to work if, in OrchardLog4netLogger.cs, we replace

_shellSettings = new Lazy<ShellSettings>(LoadSettings);

With

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

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

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

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