0

My web application is loggin huge number of below exception

    class:Sitecore.Diagnostics.Log
exception:Exception: Sitecore.Mvc.Diagnostics.ControllerCreationException
Message: Could not create controller: 'Sitecore'. 
Source: Sitecore.Mvc
   at Sitecore.Mvc.Controllers.SitecoreControllerFactory.CreateController(RequestContext requestContext, String controllerName)
   at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory)
   at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state)
   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)

Nested Exception

Exception: System.InvalidOperationException
Message: Attempt to retrieve context object of type 'Sitecore.Mvc.Presentation.PageContext' from empty stack.
Source: Sitecore.Mvc
   at Sitecore.Mvc.Common.ContextService.Peek[T]()
   at Sitecore.Mvc.Pipelines.MvcPipelineArgs.get_PageContext()
   at Sitecore.Mvc.Pipelines.Request.CreateController.CreateItemController.CreateController(CreateControllerArgs args)
   at Sitecore.Mvc.Pipelines.Request.CreateController.CreateItemController.Process(CreateControllerArgs args)
   at (Object , Object[] )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
   at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs,TResult](String pipelineName, TArgs args, Func`2 resultGetter)
   at Sitecore.Mvc.Controllers.SitecoreControllerFactory.CreateSitecoreController(RequestContext requestContext, String controllerName)
   at Sitecore.Mvc.Controllers.SitecoreControllerFactory.CreateController(RequestContext requestContext, String controllerName)

after adding args.AbortPipeline(); in my Sitecore.Mvc.Pipelines.Request.RequestBegin.RequestBeginProcessor

According to below post https://community.sitecore.net/developers/f/8/t/8985 this is expected when we do args.AbortPipeline() in requestbegin processor.

is there any graceful way to handled this exceptin and stop logging this exception?

4
  • 2
    Graceful way would be to fix the exception, not to silence logging of it in my opinion. Better fix the root cause of the problem not the problem itself. You never know where it appears later in production... Dec 18 '18 at 7:04
  • Why are you aborting the RequestBeginProcessor pipeline?
    – Richard Seal
    Dec 18 '18 at 15:56
  • @RichardSeal - aborting the processor as Im redirecting to another page and do not want the current sitecore request processing to continue.
    – nari447
    Dec 18 '18 at 16:11
  • @PeterProcházka - please can you point me to any workaround to fix this?
    – nari447
    Dec 18 '18 at 16:29
0

In my organization's code, when we want to redirect from the request pipeline, we call HttpRequestArgs.Context.Response.Redirect(), which aborts the thread at that point. We don't call AbortPipeline(). Do you know that you need to call AbortPipeline()?

2
  • HttpRequestArgs is not available in mvc.requestbeign pipeline, here is what Im exactly doing in my code args.AbortPipeline(); args.RequestContext.HttpContext.Response.Redirect("/LogOn/SignIn", true);
    – nari447
    Dec 19 '18 at 6:04
  • Have you tried to use Sitecore.Web.WebUtil.RedirectToLoginPage(); instead as suggested in your duplicated question 29 days ago with configuring login page for site? Dec 19 '18 at 6:09

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