【问题标题】:Orchard CMS Error "ValueFactory attempted to access the Value property of this instance"?Orchard CMS 错误“ValueFactory 试图访问此实例的 Value 属性”?
【发布时间】:2015-03-19 14:51:11
【问题描述】:

我正在使用 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:             }

【问题讨论】:

  • 伙计们,如果您需要有关错误的更多详细信息,请告诉我,请修复它! @Puneet Goel

标签: asp.net-mvc content-management-system orchardcms


【解决方案1】:

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

_shellSettings = new Lazy<ShellSettings>(LoadSettings);

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

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

【讨论】:

  • +1,为我工作。我将您的解决方案链接发布到official Orchard GIT's issue thread。如果 Orchard 开发人员找不到任何反对理由(例如由您的解决方案引发的其他问题),他们可能会将其添加到 Orchard 的下一个版本中。
  • @PavelV,那太好了。感谢分享。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-05-26
  • 1970-01-01
相关资源
最近更新 更多