Sitecore 页面预览期间功能区控件异常

Sitecore 页面预览期间功能区控件异常,sitecore,sitecore6,Sitecore,Sitecore6,嗨,在预览期间加载页面时,我没有加载功能区。 你有什么线索可以解决它吗 Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the erro

嗨,在预览期间加载页面时,我没有加载功能区。 你有什么线索可以解决它吗

Object reference not set to an instance of an object.

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.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[NullReferenceException: Object reference not set to an instance of an object.]
   Sitecore.Data.Database.ApplySecurity(Item[] items) +112
   Sitecore.Data.Database.SelectItems(String query) +252
   Sitecore.Shell.Applications.WebEdit.Commands.OpenMyItems.GetHeader(CommandContext context, String header) +188
   Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderSmallButton(HtmlTextWriter output, Item button, CommandContext commandContext) +307
   Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderButton(HtmlTextWriter output, Item button, CommandContext commandContext) +732
   Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderChunk(HtmlTextWriter output, Item chunk, CommandContext commandContext) +330
   Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderChunk(HtmlTextWriter output, Item chunk, CommandContext commandContext, Boolean isContextual, String id) +204
   Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderChunk(HtmlTextWriter output, Item chunk, CommandContext commandContext, Boolean isContextual) +242
   Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderChunks(HtmlTextWriter output, Item strip, CommandContext commandContext, Boolean isContextual) +442
   Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderStrips(HtmlTextWriter output, Item ribbon, Boolean isContextual, ListString visibleStripList) +800
   Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderStrips(HtmlTextWriter output, Item defaultRibbon, Item contextualRibbon, ListString visibleStripList) +215
   Sitecore.Web.UI.WebControls.Ribbons.Ribbon.Render(HtmlTextWriter output) +610
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +149
   Sitecore.Web.HtmlUtil.RenderControl(Control ctl) +74
   Sitecore.Shell.Applications.WebEdit.WebEditRibbonForm.RenderRibbon(Item item) +603
   Sitecore.Shell.Applications.WebEdit.WebEditRibbonForm.OnLoad(EventArgs e) +1238

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +76
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +193
   System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +35
   Sitecore.Web.UI.Sheer.ClientPage.OnLoad(EventArgs e) +337
   System.Web.UI.Control.LoadRecursive() +71
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178

从堆栈跟踪信息来看,问题似乎出在功能区中的
My Items
按钮上

似乎出于某种原因,加载此按钮时执行的快速查询返回一个包含null的项目列表。您有任何自定义数据提供程序吗

您可以尝试以下两种解决方案:

  • 清除
    /sitecore/admin/cache.aspx
    页面上的缓存
  • 通过以管理员身份运行此查询,查找引起问题的项目
Item[]items=Sitecore.Client.ContentDatabase.SelectItems(
“fast://*[@\uuu lock='%\'完整用户名,该用户名与域名\“%”发生异常“%”;

另一个选项是从功能区隐藏此按钮(在
core
数据库中删除或更改
/sitecore/content/Applications/WebEdit/Ribbons/WebEdit/Page Editor/Edit/My Items
的安全权限)。根据我的经验,此按钮很少在
页面编辑器
模式中使用,每次加载此模式时,都会减慢页面编辑器的速度,
My items
按钮统计当前用户锁定的所有文章,因此删除它可能是个好主意。

我在页面编辑模式下的Sitecore 7中遇到了相同的问题。我还验证了在内容编辑器中单击“我的项目”按钮时发生的错误

我找到了Alex Shyba的这篇帖子:

他的帖子建议在web.config或更好的包含文件中设置此设置:

<setting name="WebEdit.ShowNumberOfLockedItemsOnButton" value="false" />


这在页面编辑器中为我解决了这个问题,并且是干净且易于实现的。希望这也能帮助其他人解决这个问题。

使用7.1,当我从另一台机器上的备份还原数据库时,此错误开始出现。我可以通过重建搜索索引来解决此问题:

桌面>控制面板>数据库>重建搜索索引


我还清理了数据库并重建了链接数据库,但这些数据库似乎无法修复它。

您能解释一下我如何以管理员身份运行此查询吗?我在本地数据库中使用标准MS SQL连接。谢谢。这段代码可以添加到你的任何页面上-只是为了调试选项。不是永久性的改变。请记住在此查询中输入正确的用户名。并以管理员身份登录到Sitecore。但是如果用户不使用
页面编辑器中的
我的项目
按钮,我建议您从
核心
数据库中删除
/sitecore/content/Applications/WebEdit/Ribbons/WebEdit/Page Editor/Edit/My Items
项目。这是一个标准的sitecore快速查询,返回指定用户锁定的所有项目。请尝试使用
Database.GetDatabase(“master”)
而不是
Sitecore.Context.ContentDatabase
我遇到了同样的问题,重建搜索索引帮助了我。。谢谢