Posts

Monitor and Tune Cache on CD Server

Image
On the CM server, it's easy to monitor the Sitecore cache in CMS and we can tune it accordingly. It's under the Administration tool provided by Sitecore. You can access it directly from the URL i.e. {your-sitecore-instance}/sitecore/admin/cache.aspx OR browse it from the Administrative page. But on a Content Delivery server, access to the administrative pages usually is not available hence there is no direct option available to monitor Sitecore Cache for the CD server. In this blog, I will explain how to monitor cache tunning on a CD server. Go to the CD server and check the App_Data\diagnostics\health_monitor folder. You will get their file named CacheStatus.20230412Z.141522Z.html where 20230412Z.141522Z is a time stamp. (Sitecore saves a copy of the cache.aspx page every ten minutes) Note: Most of the cases you will get the file under the folder but in case you cannot find the file then you need to enable

Cross-origin Issue in Sitecore Multisite

Image
While working on the Sitecore multisite, I faced the following issue while accessing the API with website-B. This happens when you want to use your web API with another website in Sitecore multisite setup. Cross-Origin Resource Sharing (CORS) is a W3C standard that allows a server to relax the same-origin policy. When you use CORS, a server can explicitly allow some cross-origin requests while rejecting others. Sitecore provides CORS support for Web API services. You can configure CORS in three ways: Globally for all Web API services (configured in the Sitecore.Services.Client.config file). Using an API key. Using the EnableCors attribute. I have used the first option to solve my issue. You need to modify "Sitecore.Services.Client.config" at path {instance}/ \App_Config\Sitecore\Services.Client with registered origins. Create a patch file in the project and add the following section of code and allow origin

Sitecore.SessionProvider.Redis.StackExchangeClientConnectionAsync

Image
We had encounter the following error frequently in our application. Problem Id: System.NullReferenceException at Sitecore.SessionProvider.Redis.StackExchangeClientConnectionAsync+<EvalAsync>d__22.MoveNext Message: Object reference not set to an instance of an object. Exception type: System.NullReferenceException Failed method: Sitecore.SessionProvider.Redis.StackExchangeClientConnectionAsync+<EvalAsync>d__22.MoveNext Call Stack: StackExchange.Redis DLL version: 2.1.58 The application is deployed on Sitecore Managed Cloud Service Azure PaaS and uses Redis app service . I have applied the below fixes as well as the following articles but the issue is not resolved: Increased the min worker thread pool to 100 Increased polling Interval to 60 Tuned Redis Configuration as described here: Tuning Redis Configuration Settings Added sslprotocols=tls12 to Redis connection string Sitecore PAAS Redis Exce

Sitecore Media in Database Vs. File Directory Vs. Blob Storage

Image
We understand that Sitecore provides an option to store media library assets either in DB (defaults to DB) or in the filesystem or we can store it in the Azure Blob Storage. But the question is what is the best option from all three options and why? Here in this blog, I will discuss the pros and cons of all three options and help you to find the best possible option. 1. Sitecore Database: By default, Sitecore provides this option while uploading the media items to the Sitecore Media Library. If you will delete the Media item from the library, it will be deleted from the Sitecore database and Sitecore also provides a database clean-up tool Cleanup database. 2. File Storage: To upload the media library assets (Image, Video, Pdf, etc) to the file storage you need to update the value of the following variable in the Sitecore. config file: <setting name="Media.UploadAsFiles" value="false" /> Set it to true. <setting name

Sitecore Technology MVP Journey 2023

Image
Getting the badge of Sitecore MVP the second time in a row particularly in Technology for me is one of them. My journey for Sitecore MVP begins in the Year 2019. I commenced with Sitecore Technology blogs , and actively participate in the Sitecore Stack Exchange Platform , Sitecore Slack Channel , and SUGCON public speaking. I am honored to be named Sitecore Technology MVP 2023 . I feel fortunate to be participating with a Sitecore Community, Technology, and Product. I am happy that my all efforts and contributions are recognized by Sitecore and Community. My next focus for this year would be: Exploring more in Sitecore Project including Personalize and CDP, Content Hub, and XM Cloud. Continuing with sharing and helping others in Sitecore Community. Participating in Sitecore MVP mentorship program. A big thanks to my family, colleagues, and Sitecore Team, and congratulations to all the Sitecore 2023 MVP award winners. Happy Sitecor

Basic Authentication in Sitecore 10

Image
Wish you all a very Happy New Year 2023😊 In today’s blog I will discuss the basic authentication implementation is Sitecore 10. Basic Authentication may be required for you to protect and restrict the page, and website access from the external source or you can apply it on the UAT, staging, or prod before going live. You can implement it multiway either by Sitecore Pipeline or Global.asax page. Here I will describe the Sitecore pipeline approach, issues, and solutions. I would like to give the credit to the original blog post mentioned here , but in Sitecore 10 you will need to perform some extra steps that I will describe in this blog. Pipeline: Config file: After execution of it, you will get the below infinite loop issue: Solution: Add the below key in your web.config : <add key="owin:AutomaticAppStartup" value="false" /> Next, you will get the credential windows and after entering it, it will show

Upgrade Sitecore Project to Version 10.2

Image
This year, I got the opportunity to work on upgrading Sitecore projects from Sitecore versions 8.2, and 9.X to Sitecore version 10.2. To find the complete details with the steps Sitecore provides Sitecore SC-XP-10.2.0-Upgrade-Guide for Sitecore experience platform 10.2 from Sitecore Experience Platform 8.1.0 or later. You can refer to this PDF file and start working on the upgrade. While upgrading the projects I have written my all findings, issues, research, and solutions in individual blogs. That you may or may not face while upgrading your project. In this blog post, I am summarizing all these within a single blog. Upgrade the framework and Database: Dot NET Framework Migrator: To upgrade Sitecore from a lower version to Sitecore 10.2, you need to change the .net framework to 4.8. See the blog post- Dot NET Framework Migrator Upgrade Sitecore XP Database to the XM: The database upgrade is one of the most

Upgrade Sitecore XP Database to the XM

Image
The database upgrade is one of the most important steps while upgrading the Sitecore version to the latest 10.2. Sitecore provides its upgrade guide for Sitecore experience platform 10.2 from Sitecore Experience Platform 8.1.0 or later. Here in this blog, I have taken reference to the pdf document provided by Sitecore SC-XP-10.2.0-Upgrade-Guide and I am going to discuss only the database upgrade steps for the XM topology. Prerequisites for upgrading: Back up the database. Download the Sitecore 10.2.0 rev. 006766 (upgrade files).zip  It contains: Database Upgrade Script.zip - contains the SQL scripts that upgrade the database schemas and data. MarketingDefinitionsUpgrade.zip – contains the .aspx pages that help you prepare your marketing definitions for the upgrade from Sitecore XP 8.x. Download the tools Sitecore.UpdateApp 1.2.0 for Sitecore X.X.X rev XXXXXX.zip Y

Slowness and Performance Issues and Solutions in Sitecore MCS

Image
After deploying the application on Sitecore Managed Cloud Service(MCS) CM and CD instances, both environments were unresponsive and taking too much time to respond. To observe the issue and find the reason behind the issue you can perform the following operations. I am explaining the reason and the solution in this blog post. Here for better understanding, I am taking an example of one instance that is CM. Collect a performance Profile from the CM server: To investigate the issue in detail you can collect a performance profile. This will affect the performance of the CM server during profile capture. To collect the performance profile you can refer to the Sitecore KB article: Collecting a Performance Profile Razor Generator Tool: Sitecore stores compiled code in the Azure file system which is known to be slow due to relying on Blob storage internally. You can pre-compile all custom views via the Razor Generator tool

Add Custom Fields in SOLR Index on Crawler

Image
While upgrading the project from Sitecore version 8.2 to 10.2 I faced one scenario to convert the Lucene Search configuration to the SOLR. It’s easier to convert the Lucence configuration to the SOLR if all configurations are defined in the configuration files. You just need to change the type to the Solr Provider and configuration to the defaultSolrIndexConfiguration or if it does not default then define the custom Solr Index configuration . The problem occurs when the index file is generated at runtime and custom fields are added dynamically either on the pipeline or Search Crawler. In my case in Sitecore 8.2 lucence configuration fields were added in the document at runtime on SitecoreItemCrawler . Custom Crawler: Code was written on the custom crawler: Solution: To resolve the above issue and find the solution, I have explored Sitecore.ContentSearch DLL and found out it provides the below method in the IProviderUpdateContext interface.

Sitecore Identity Server: Sorry, There Was an Error

Image
After restoring the upgraded database to the SQL, I tried to login into the Sitecore CMS. The identity server comes with an error " Sorry, there was an error " after successful login. I have checked the Identity server logs files and found the error:  CORS policy execution failed . Solution: Go to the {root-directory}\project-identityserver.local\Config\production and open Sitecore.IdentityServer.Host.xml file and verify the database name. If it is corrects, then check the <AllowedCorsOrigins> section. In my case it was related to the database name, I forget to update the database name and connection string in the identity server. Note: Do not forget to recycle the Identity Server App pool. Happy Sitecoreing  ðŸ˜Š