How to install MiniProfiler in Sitecore

Posted 12 November 2014 12:00 AM by Sergio Gisbert, .Net Developer @ ClearPeople

The problem to solve

Sitecore has some tools for performance profiling that we can use out-of-the-box, like /sitecore/admin/stats.aspx or the Debug mode in the Page Editor. But, in my opinion, they’re useful when you already know you have a problem, and even then, they’re not really straight-forward to use. But how can we detect in real-time that we have a performance problem? I suggest using MiniProfiler

The tool that will solve it

MiniProfiler is a light-weight plugin for ASP.NET applications that add live profiling capabilities to our application. Apart from the basic plugin (ASP.Net WebForms), there are also several extensions for MVC, EF, Ruby, Node.js, etc.

MiniProfiler will add an unobtrusive layer on the top left side of the website with the time taken to render it. Then we can open it to see the whole breakdown of steps.




This way we can easily see if a concrete page is taking more time than necessary, and then try to dig deeper in the components that conform that page, using Sitecore profiling or our own methods. Please refer to MiniProfiler documentation at or check the sample project at GitHub ( to see how you can wrap your own profiled sections in your code, and see them at the output layer.

How to install MiniProfiler in Sitecore

As MiniProfiler is deployed through Nuget, it seems that getting it up and running in Sitecore should be something easy. But there are a couple of things to do before this comes true.

Installing MiniProfiler plugin

The first step is to get the MiniProfiler package to our website. To do so, we will open the “Package Manager Console” in Visual Studio and select our Website project in the “Default project” dropdown.


We can use MiniProfiler capabilities in other projects that are part of the solution (data layer, services, etc.), where it will probably make more sense than in the top layer website. Then we will need to install the package in those projects as well.
In this case we’re installing the basic package for WebForms, as this has been tested against a Sitecore 6.6 installation. We can use the specific packages for MVC if needed.

MiniProfiler setup

We need to add three small changes to our website to have MiniProfiler running:


We will copy the configuration from the sample website:

I suggest modifying the method void InitProfilerSettings() and including these lines:


// Sitecore specific URLs

So we avoid messing up with static files and Sitecore specific urls timing.


1. Make sure the <modules> section looks like this: 

<modules runAllManagedModulesForAllRequests="true">

2. Edit the IgnoreUrlPrefixes setting, and add the following url, /mini-profiler-resources. It should look like: 

<setting name="IgnoreUrlPrefixes" value="/mini-profiler-resources|/sitecore/default.aspx|/trace.axd|..." />

Default layout

Finally, we must add the frontend resources (CSS/JS) that render the layer in the site. To do so, we have to add the following line to our main layout, at the end, just before the </body> tag:

<%= StackExchange.Profiling.MiniProfiler.RenderIncludes(useExistingjQuery:false) %>

This is the WebForms syntax. Please refer to the documentation if you’re using MVC.


MiniProfiler is a widely recommended way to include basic profiling in our website projects, and it’s really helpful to have your code under control.

The main trick to get it working with Sitecore was adding the MiniProfiler url to the ignored Urls by Sitecore, so Sitecore doesn’t think it’s an item path and return a 404 error.

This has been tested with Sitecore 6.6, but it will probably work as well with newer versions.

This post is an update from the original post in Spanish at my personal blog


Add your comment





Microsoft Teams Office 365 Yammer cms content management system agile GDPR Microsoft Graph collaboration Microsoft sharepoint 2016 upgrade migration SharePoint Online 2016 Tech Trends Digital Disruption Context marketing marketing SharePoint 2010 SharePoint 2013 TFS Git security kentico Analytics intranet jquery QA Quality Assurance testing digital workspace content management websites Sitecore sitecore marketplace sitecore module cloud Microsoft Cloud Storage digital strategy technical consulting sitecore modules Experience database Sitecore 7 Sitecore 8 support account management customer experience Data Storage windows azure cms integration front end front end development prototype Cloud Storage StorSimple Front-end Development Layout SharePoint 2013 colour palette UI design website design log viewer sitecore cms website Azure big data business-critical sharepoint accessibility android apple chrome clear people clearpeople debug emulator ios mobile testing opera resize adobe desktop flash ie10 internet explorer 10 metro windows 8 bcsp SharePoint Advanced System Reporter reporting framework ControlMode form control master page placeholder publishing console SharePoint 2007 SharePoint error search search results search values software testing testing scenario audit content information architecture retention schedules PowerShell QuickLaunch scripts SharePoint server 2010 business solutions metalogix replication replicator storagepoint stena technet UK Technet picture library slideshow web part RTM released to manufacturing caml caml query MOSS 2007 query infopath