Showing posts with label error. Show all posts
Showing posts with label error. Show all posts

Tuesday, December 17, 2024

Sitecore issue after upgrade | Connection string cortex.processing.engine is not found

 Hi All,

In my recent blogs, I discussed the Sitecore upgrade process from version 10.1 to 10.4. I have listed the overall steps and the issues I encountered during the upgrade. If you haven't read my last blog yet, you can check it out by visiting the following URL:

https://sitecoreknowledgeshare.blogspot.com/2024/11/sitecore-upgrade-101-to-104-part-1.html

Our upgrade work is going very well, but we have encountered one issue that frequently appears in our logs whenever we try to open the Experience Editor or a page in Preview mode. The error is as follows:

"Connection string 'cortex.processing.engine' is not found"

I tried to investigate and found a solution on Stack Overflow. Here is the link:

https://sitecore.stackexchange.com/a/35737/1146


I hope you enjoy this Sitecore blog. Stay tuned for more Sitecore related articles.

Till that happy Sitecoring :)

Please leave your comments or share this article if it’s useful for you.

Tuesday, May 23, 2017

Sitecore 404 and 500 handle

Today we discuss, how we can handle 404 and 500 in Sitecore.
I found below URL useful as well.
https://www.akshaysura.com/2016/08/02/secure-sitecore-why-use-a-custom-500-error-page/ 
http://findgnosis.com/2015/05/14/ideal-error-handling-for-sitecore/ 

Handle 500 Error:
So first I talk about 500 error handle for that I use to replace below line in web.config

<customErrors mode="RemoteOnly"/>

to

<customErrors mode="On" defaultRedirect="~/Error/500Error.html" redirectMode="ResponseRewrite"/>

According to Akshay sura blog that is the good approach to take static HTML page for handle 500 error.

Handle 404 Error:

Now come to 404 error. For this I take two settings as below:

<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
        <settings>
      <!--For handle 404 error-->
      <setting name=CustomError.Page404Resolver" value="ItemId"/>
      <setting name="RequestErrors.UseServerSideRedirect" value="true" />
    </settings>
  </sitecore>
</configuration>

The first one takes the item id for the 404-page item that is shown when 404 error occurs.
Second setting just keeps maintaining the same address which we request for. If you don't use this setting then after resolving item it shows 404 item name in URL instead of address which you type.

For handle 404 we place our code after item resolve that makes significant action if item not found(404).

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <pipelines>
      <httpRequestBegin>
        <processor type="CustomError.ErrorHandler.Page404Resolver, CustomError"

                   patch:after="processor[@type='Sitecore.Pipelines.HttpRequest.ItemResolver, Sitecore.Kernel']"/>
      </httpRequestBegin>
    </pipelines>
  </sitecore>
</configuration>

Page404Resolver.cs:


namespace CustomError.ErrorHandler
{
    public class Page404Resolver : HttpRequestProcessor
    {
        public override void Process(Sitecore.Pipelines.HttpRequest.HttpRequestArgs args)
        {
            if (Sitecore.Context.Item != null || Sitecore.Context.Site == null || Sitecore.Context.Database == null || WebUtil.GetRawUrl().IndexOf("/sitecore") > -1)
            {
                if (Sitecore.Context.Database != null && ID.IsNullOrEmpty(LanguageManager.GetLanguageItemId(Sitecore.Context.Language, Sitecore.Context.Database)))
                {
                    SetCustomErrorPage(args);
                }
                else
                {
                    return;
                }
            }
            SetCustomErrorPage(args);
        }

        private void SetCustomErrorPage(HttpRequestArgs args)
        {
            string errorPagePath = Settings.GetSetting("CustomError.Page404Resolver");

            var item = args.GetItem(errorPagePath);
            if (Sitecore.Context.Item != null && Sitecore.Context.Item.Versions.Count == 0)
            {
                item = item.Database.GetItem(item.ID, Sitecore.Globalization.Language.Parse("en"));
                Sitecore.Context.Language = Sitecore.Globalization.Language.Parse("en");
            }
            if (item != null)
            {
                Sitecore.Context.Item = item;
                args.Context.Response.StatusCode = 200;
                args.Context.Response.TrySkipIisCustomErrors = true;
            }
        }

    }
}


In case if item not found(sitecore context item have null value) on that case above code get the 404 page item id from setting variable and resolve the item of 404 and replace with context item.

Hope that may help you to resolve 404 and 500 error.
Till that happy Sitecoring :)

Please leave your comments or share this article if it’s useful for you.