I have got Sitecore 9.1.1 installed on CM and CD server. I am getting the below exception only on the CD server:

5048 12:18:51 ERROR Application error.
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Sitecore.Mvc
   at Sitecore.Mvc.Pipelines.Request.RequestBegin.EnsureLoggedInForPreview.Process(PipelineArgs args)
   at (Object , Object )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
   at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
   at Sitecore.Mvc.Routing.RouteHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

I did have a look at the process in Sitecore.Mvc it is:

public class EnsureLoggedInForPreview
    public void Process(PipelineArgs args)
      if (Context.PageMode.get_IsNormal() || Context.get_IsLoggedIn())
      using (new SiteContextSwitcher(Factory.GetSite("shell")))
        using (new UserSwitcher(Context.get_User()))

I am imagining the page mode is not available on CD server. Should I disable the pipeline on the CD server?

  • I think your PipelineArgs are null Please cross check. Jun 12, 2019 at 11:55
  • But it is a native sitecore pipeline so why would pipelineArgs be null?
    – Arun Kumar
    Jun 13, 2019 at 1:35

2 Answers 2


I manage to fix the problem my contact Sitecore support. There was a problem with order of my custom register routes pipeline was running in the pipeline. I had to change all my custom route piplelines as below:

<processor patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeGlobalFilters, Sitecore.Mvc']"            type="Sitecore.Feature.Integeration.Infrastructure.Pipelines.RegisterRoutes, Sitecore.Feature.BPointIntgration" />


<processor patch:after="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc']"            type="Sitecore.Feature.Integeration.Infrastructure.Pipelines.RegisterRoutes, Sitecore.Feature.BPointIntgration" />

This looks like the version of some dlls is not correct.

Please check the version of Sitecore.mvc.dll and other dlls as well.

  • I have checked version of the DLL's and they are the correct dll's.
    – Arun Kumar
    Jun 13, 2019 at 1:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.