1

I'm following this guide for dynamic placeholders and cannot get my getPlaceholderRenderings pipeline to run.

I cannot see why this pipeline isn't working:

<getPlaceholderRenderings>
  <processor type="Site.CMS.Specialization.Pipelines.GetDynamicKeyAllowedRenderings, Site.CMS"/>
  <processor type="Sitecore.Pipelines.GetPlaceholderRenderings.GetAllowedRenderings, Sitecore.Kernel"/>
  <processor type="Sitecore.Pipelines.GetPlaceholderRenderings.GetPredefinedRenderings, Sitecore.Kernel"/>
  <processor type="Sitecore.Pipelines.GetPlaceholderRenderings.RemoveNonEditableRenderings, Sitecore.Kernel"/>
  <processor type="Sitecore.Pipelines.GetPlaceholderRenderings.GetPlaceholderRenderingsDialogUrl, Sitecore.Kernel"/>
</getPlaceholderRenderings>

My processor looks like this:

public class GetDynamicKeyAllowedRenderings : GetAllowedRenderings
{
    public new void Process(GetPlaceholderRenderingsArgs args)
    {
        string placeholderKey = args.PlaceholderKey;

    }
}

At this stage I'm just testing that it runs. Which it doesn't.

I've done exactly what the guide says to do and yet this pipeline never runs. I've rebuilt countless times, recycled my application pool, and restarted IIS. None of which helps as when I debug my application with a break point in that pipeline it just isn't hit.

Update

I tested that my pipelines were being hit by adding the following code:

public class ExceptionThrower : HttpRequestProcessor
{
    public override void Process(HttpRequestArgs args)
    {
        throw new Exception("ExceptionThrower");
    }
}

And this line to the config:

<httpRequestBegin>
  <processor type="Site.CMS.Specialization.Pipelines.ExceptionThrower, SCW.CMS" />
  <processor type="Sitecore.Pipelines.PreprocessRequest.CheckIgnoreFlag, Sitecore.Kernel"/>
  <processor type="Sitecore.Pipelines.HttpRequest.EnsureServerUrl, Sitecore.Kernel"/>
  .
  .
  .
</httpRequestBegin>

This gets hit and I see the exception.

If I add it to getPlaceholderRenderings it doesn't get hit.

The example I've been following (http://www.techphoria414.com/Blog/2011/August/Dynamic_Placeholder_Keys_Prototype) has exactly the same name, inheritance and parameters as my original code.

4

1 回答 1

1

我认为问题是由GetAllowedRenderings类和new关键字的继承引起的。尽量不要继承GetAllowedRenderings并看到断点被击中:

public class GetDynamicKeyAllowedRenderings
{
    public void Process(GetPlaceholderRenderingsArgs args)
    {
        string placeholderKey = args.PlaceholderKey;

    }
}

还要检查ShowConfig.aspx页面是否在合并配置中显示您的渲染:http://localhost/sitecore/admin/showconfig.aspx

于 2013-05-28T11:03:32.087 回答