Orchard CMS 错误“ValueFactory 试图访问此实例的 Value 属性”?

2024-04-25

我正在使用 orchard 1.8.1 并尝试安装主题 Bootstrap,它给了我以下错误。谁能帮我吗? 描述:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其在代码中的来源的更多信息。

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

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

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

_shellSettings = new Lazy<ShellSettings>(LoadSettings);

With

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

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

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Orchard CMS 错误“ValueFactory 试图访问此实例的 Value 属性”? 的相关文章

随机推荐