Globalization Setting Sitecore PaaS and SMC

Hi Champs,

Today I am going to give you quick quick learning details about how you can setup default Culture of your Sitecore Application.

First question which will get raised why you want set  this?(specifically in Azure PaaS and Sitecore Managed Cloud)

Answer to this question is now a days we host Sitecore application in Azure PaaS or any Other Cloud offerings where the actual Timezone and Culture is different. In this case the impacts will come to few part off your application where your using default culture settings in application globalization. Which means miss match of time/date formats etc.

Next question will be How we can fix it ?

So the answer is as below.

  1. Go to your Sitecore application.
  2. Open Web.config.
  3. Serch for below term.                                                                                          “<globalization”
  4. You will find a predefined setting with few attributes but you can set few more attributes like below to set default Culture of your application.
<globalization requestEncoding="utf-8" responseEncoding="utf-8" enableClientBasedCulture="false" culture="en-GB" uiCulture="en-GB" />

Note:

  1. This setting is totally different than the Time Zone setting for Sitecore application.
  2. What I mean over here is even if you set Time Zone to the one which you want in Cloud still you will get issues with formats.
  3. So this settings will help all those issues in Sitecore.
  4. This settings is tested of in Azure PaaS and Sitecore Managed Cloud.

Happy Learning

Advertisement

Setting up the Razor Generator for Visual Studio Application

Hi Champs,

Today I am going to explain how we can setup the Razor Generator to you Sitecore Visual Studio Project for Pre-Compiled MVC views. Below are the steps to configure this.

  1. Open your MVC solution in Visual Studio.
  2. Install the Razor Generator tool.
  3. Open Properties of your view (.cshtml file).
  4. Set the Custom Tool field value to RazorGenerator and press Enter. In this case, a .cs file with the source code should be created for a view.rezor
  5. Build your project and copy the assembly with precompiled views into the \bin folder of your Sitecore XP solution.

Happy Learning

Profiling a Sitecore Web App on Azure App Service

Azure

Hi Champs,

Today I am going to help you with how you can collect .NET Profiler Trace in Azure App Service. With out any further details we will jump in below details.

The Diagnostic Tools options under the Diagnose and Solve blade for Azure App Services has been live for a few months now and has many tools that help you troubleshoot apps based on their application stack. In this post, we are going to cover the Collect .NET Profiler Trace option in detail and how you can use it to troubleshoot a slow or a failing ASP.NET based Web App.  Profiler tool helps in collecting an on-demand trace that lets you identify the underlying .NET exceptions, time taken in the various request processing pipeline stages and even lets you drill down into exact methods within the application code that are taking time. It is extremely useful in situations where the problem is happening right now and you want to collect some data to identify the root cause of the issue. Profiling is designed for production scenarios and is based on ETW (Event tracing for Windows) . The analysis component of the profiler uses the TraceEvent library to generate a report that helps you drill down in to the problems in matter of a few minutes. It should be noted that no changes are made to your Web App code or your configuration during the collection or the analysis phase. In fact, the web app is not even restarted as a result of capturing this trace. The captured trace has ETW events emitted by the IIS and the ASP.NET providers along with stack traces captured at the CPU level. You can use this tool to efficiently troubleshoot delays which are relatively small (less than a second too) without impacting the run-time performance of the application. At this point, the profiler works only for ASP.NET web apps only and ASP.NET Core support might come soon.

How to Collect the Trace

To collect the trace, go to the App Service in your Azure PaaS, then go to  Diagnose and Solve Problems  and choose the Collect .NET Profiler Trace option under Diagnostic Tools option and click on Collect Profiler Trace. Unless you have isolated that only a specific instance is failing, it is best to just select all the instances on which your Web App is running.  Add thread report option – With this option enabled, a thread report of all the threads in the process is also collected at the end of the profiler trace. This is useful especially if you are troubleshooting totally hung processes, deadlocks or requests taking more than 60 seconds. This will pause your process for a few seconds until the thread dump is generated. This option is NOT recommended if you are experiencing high CPU on the instance because if the instance is under stress, it might take a long time to even start a new process to collect the thread dumps. Clicking the Collect Profiler Trace will start profiling the Web App and the wizard will show progress of various steps involved.  Once the profiler trace is started, reproduce the issue by browsing the Web App. If you have a Web App running on multiple instances, make sure to browse a few more times to ensure that the requests to the web app get captured in the profiler trace. The default duration for which the profiler trace runs is 60 seconds and during this 60 seconds, all the requests that were made to the Web App get captured in the profiler trace. It is important to note that the profiler trace only has information about the requests that were captured in these 60 seconds (It is possible to increase this duration as mentioned below in this article) After 60 seconds, the profiler automatically stops, and an analysis component gets triggered that starts analyzing the profiler trace that just got captured. After the analysis finishes, a link to view the profiler report for every instance serving the web app is generated and you click on the Open Report button to view the Analysis report. 

Happy Learning