My new blog present here.

Featured Post

Insights into Sitecore Search: A Definitive Introduction

A key component of digital experience management is effective information retrieval. A simplified approach is required for websites, applications, and platforms containing a lot of material so that consumers can easily get the data they require. This need is met by Sitecore, a well-known name in the field of digital experience platforms (DXPs), which provides powerful and comprehensive search functionality. We will travel into the realm of Sitecore Search in this article, learning about its capabilities, architecture , and the enormous value it offers both developers and end users. Introduction to Sitecore Search    A headless content discovery platform powered by AI , Sitecore Search enables you to build predictive and custom search experiences across various content sources. To extract and ...

Sitecore Error Troubleshooting: Sitecore 9.1 Current Content Database returns Master Database in Content Delivery Web Site

Sitecore Error Troubleshooting: Sitecore 9.1 Current Content Database returns Master Database in Content Delivery Web Site


Error Details: I was debugging the code base after sending the request from publishing website in Sitecore 9.1 and Sitecore.Context.Database was returning Master Database instead of Web database.


To troubleshoot the issue “Sitecore.Context.Database was returning Master Database”, I checked the Site definition configuration file to verify that site pointing to Master Database or Web Database and found that configuration was showing Sitecore website pointing to Web database”.

To troubleshoot more to identify the root cause of issue, I checked the configuration of Sitecore 9.1 website using the http://<host name>/sitecore/admin/showconfig.aspx:

In the above configuration file, I found that Site B pointing to Master Database with the help of role based configuration patch file:
This file was containing the Unicorn Source Folder related configuration details including the role base patch file for Standalone mode (a single Sitecore instance performing all server roles or local development environment) where database pointing to Master database.

Due to this rule-based configuration setting, Sitecore website Current Context was pointing to the Master Database instead of Web database. After removing this rule based configuration, Sitecore website current context start pointing to Web database when request coming from the published website.

This rule based configuration coming up with Habitat demo solution for Habitat Website and needs to be deployed on Development machine only and do not need to be pushed to the higher environments.

Reference Articles:
https://doc.sitecore.com/developers/91/platform-administration-and-architecture/en/rule-based-configuration.html
https://sitecore.stackexchange.com/questions/9924/sitecore-context-returns-master-instead-of-web-database

Comments

Popular posts from this blog

Sitecore GraphQL Queries

Sitecore Experience Manager Cloud (XM Cloud) Building blocks

Configuring Sitecore Next.js Headless SXA Multisite App in a Sitecore Container