Orchard CMS Error “ValueFactory attempted to access the Value property of this instance”?

自闭症网瘾萝莉.ら 提交于 2019-12-09 13:53:16

问题


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:             }

回答1:


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



来源:https://stackoverflow.com/questions/28061228/orchard-cms-error-valuefactory-attempted-to-access-the-value-property-of-this-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!