C# 无法执行“向Sitecore内容编辑器功能区添加按钮以调试任何数据库中的任何项目”

C# 无法执行“向Sitecore内容编辑器功能区添加按钮以调试任何数据库中的任何项目”,c#,asp.net,debugging,sitecore,sitecore6,C#,Asp.net,Debugging,Sitecore,Sitecore6,我尝试创建一个调试按钮,如下所示,从底部引用,我在core数据库中编译和配置了该按钮,并配置了Commands.config,但当我从功能区单击并重新启动sitecore管理客户端时,在主数据库上收到错误消息。我没有得到错误消息所指的内容 功能区按钮屏幕 错误消息文本 表单上不存在控制系统。位于Sitecore.Shell.Framework.Commands.CommandManager.GetMethodCommandString位于Sitecore.Shell.Framework.Comm

我尝试创建一个调试按钮,如下所示,从底部引用,我在core数据库中编译和配置了该按钮,并配置了Commands.config,但当我从功能区单击并重新启动sitecore管理客户端时,在主数据库上收到错误消息。我没有得到错误消息所指的内容

功能区按钮屏幕 错误消息文本 表单上不存在控制系统。位于Sitecore.Shell.Framework.Commands.CommandManager.GetMethodCommandString位于Sitecore.Shell.Framework.Commands.CommandManager.GetDispatchCommandString位于Sitecore.Web.UI.Shear.ClientPage.DispatchString位于Sitecore.Web.UI.Shear.ClientPage.OnPreRenderEventArgs e的命令

错误消息屏幕 下面提到的另一件事似乎不包含John在文章中所说的“参考资料部分提供的原型zip”。。有人能看出我是不是错了吗

附言:这是旧邮件吗

Debug.cs代码 参考链接:
prototype链接有一个zip文件,其中包含Debug.cs文件。 代码如下

using System;

namespace Sitecore.Sharedsource.Shell.Framework.Commands.System
{
  [Serializable]
  public class Debug : Sitecore.Shell.Framework.Commands.Command
  {
    public override void Execute(
      Sitecore.Shell.Framework.Commands.CommandContext context)
    {
      Context.ClientPage.ClientResponse.CheckModified(false);
      Sitecore.Data.Database contentDatabase = Context.ContentDatabase;

      if ((context.Items != null) && (context.Items.Length == 1))
      {
        Sitecore.Data.Database database = context.Items[0].Database;
      }

      Sitecore.Text.UrlString webSiteUrl = 
        Sitecore.Sites.SiteContext.GetWebSiteUrl();
      webSiteUrl.Add("sc_debug", "1");

      if ((context.Items != null) && (context.Items.Length == 1))
      {
        Sitecore.Data.Items.Item item = context.Items[0];

        if (item.Visualization.Layout != null)
        {
          webSiteUrl.Add("sc_itemid", item.ID.ToString());
        }

        webSiteUrl.Add("sc_lang", item.Language.ToString());
      }

      if (contentDatabase != null)
      {
        webSiteUrl.Add("sc_database", contentDatabase.Name);
      }

      webSiteUrl.Add("sc_prof", "1");
      webSiteUrl.Add("sc_trace", "1");
      webSiteUrl.Add("sc_ri", "1");
      Context.ClientPage.ClientResponse.Eval(
        "window.open('" + webSiteUrl + "', '_blank')");
    }
  }
}

让我知道这段代码是否对您有帮助,如果我找到更多信息,我会回复您。

在博客帖子上提供的解决方案原型解决了我的问题,我已经在命令中配置了我自己的Debug.cs类文件,并将Debug.item文件从解决方案原型zip复制到文件夹位置,如本文中指定的以及下面提到的,现在它正在工作

如需将来参考,请查看下面的步骤,如博客文章所示,以配置帮助我的解决方案原型

要使用序列化文件创建命令定义项,请执行以下操作:

从中可用的原型zip复制Debug.item文件 参考资料部分,在博客文章的末尾 /数据/序列化/核心/站点核心/内容/应用程序/内容 Sitecore的编辑器/功能区/块/发布子目录 解决方案,其中/data文件夹通常是 网站文件夹。 以管理员身份登录Sitecore桌面。 单击右下角的数据库图标,然后选择 按Sitecore客户端中的说明显示菜单中的Core 配置食谱。 打开内容编辑器,导航到 /sitecore/content/Applications/content Editor/Ribbons/Chunks/Publish 项目将该路径复制到剪贴板,然后将其粘贴到搜索框中 在内容树上方,按Enter键,选择第一个结果。 在“开发人员”选项卡上的“序列化”组中,单击“还原树”。如果 右键单击/sitecore/content/Applications/content 内容树中的编辑器/功能区/块/发布项,然后 从出现的子菜单中单击“刷新”,将显示一个新的调试项目 显得 请记住使用数据库图标选择主数据库 数据库
PS:但是,当我自己从core数据库在content editor中创建调试项目时,它不工作,我不知道为什么。

Harsh,看不到功能区按钮屏幕和错误消息屏幕图像。请添加它们。功能区按钮屏幕与所示相同,错误消息屏幕为对话框,显示问题中提供的错误消息文本,对话框内容标题为Sitecore遇到问题,需要关闭。我们为给您带来的不便感到抱歉..博客上的原型zip链接在哪里?John问,让我们看看他说了什么。如果您已经知道上述代码将删除此答案。请再次查看John West的。解决方案原型现在可以下载了,John已经对其进行了更新。让我们看看这是否解决了您的问题。谢谢,John West的解决方案原型解决了我的问题,我使用了原型中的debug.item和我实现的debug.cs。
using System;

namespace Sitecore.Sharedsource.Shell.Framework.Commands.System
{
  [Serializable]
  public class Debug : Sitecore.Shell.Framework.Commands.Command
  {
    public override void Execute(
      Sitecore.Shell.Framework.Commands.CommandContext context)
    {
      Context.ClientPage.ClientResponse.CheckModified(false);
      Sitecore.Data.Database contentDatabase = Context.ContentDatabase;

      if ((context.Items != null) && (context.Items.Length == 1))
      {
        Sitecore.Data.Database database = context.Items[0].Database;
      }

      Sitecore.Text.UrlString webSiteUrl = 
        Sitecore.Sites.SiteContext.GetWebSiteUrl();
      webSiteUrl.Add("sc_debug", "1");

      if ((context.Items != null) && (context.Items.Length == 1))
      {
        Sitecore.Data.Items.Item item = context.Items[0];

        if (item.Visualization.Layout != null)
        {
          webSiteUrl.Add("sc_itemid", item.ID.ToString());
        }

        webSiteUrl.Add("sc_lang", item.Language.ToString());
      }

      if (contentDatabase != null)
      {
        webSiteUrl.Add("sc_database", contentDatabase.Name);
      }

      webSiteUrl.Add("sc_prof", "1");
      webSiteUrl.Add("sc_trace", "1");
      webSiteUrl.Add("sc_ri", "1");
      Context.ClientPage.ClientResponse.Eval(
        "window.open('" + webSiteUrl + "', '_blank')");
    }
  }
}