Using the MVC-Mini-Profiler with Umbraco

by dotnetnerd 16. January 2012 08:50

Prelude

The last year I have been posting more or less the same blogposts here and at blog.vertica.dk – but my plan is to stop that going forward. I have been asked to do more blogging in Danish, and that fits pretty well with the fact that I have been postponing making a decision on which blog to stick with, since I don’t care much for the cross posting. So going forward this blog will be kept in English and It will contain the topics that are either micro-posts or a bit off topic for what I do at Vertica. So lets get started!

Mini-Profiler colliding with Umbraco

For some time I have been using the MVC-Mini-Profiler, to get a quick look at how my pages perform during development. The good thing about the mini-profiler is that it is so light weight, requires little setup and it is a lot less intrusive than most profiling tools.

In spite of its name the profiler works just fine with regular ASP.NET websites and applications, however I did run into a little twist when using it with Umbraco, which is what I want to share today.

To get started using  mini-profiler you simply add the nuget package to your project, and do the regular setup with adding scripts and calling start and stop methods on the profiler.  If you run your site now, nothing will happen that is visible to the naked eye – doh!

The solution

If you take a look at the DOM by using your favorite browsers developer-tools/firebug you will see that some container elements have been added to the page but with no content. This is because the elements are loaded asynchronously, but as the tab in your developer-tool that shows network traffic shows the call to mini-profiler-results returns a 404.

So as you may have guessed by now if you are used to working with Umbraco, you also need to add the mini-profiler-results to the umbracoReservedUrls in the web.config making it look something like this:

<add key="umbracoReservedUrls" value="~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/mini-profiler-results" />

Now if you run the site, you should get the profiler box in the top-left corner of the site, and you are ready to go hunting for performance bottlenecks.

Who am I?

My name is Christian Holm Diget, and I work as an independent consultant, in Denmark, where I write code, give advice on architecture and help with training. On the side I get to do a bit of speaking and help with miscellaneous community events.

Some of my primary focus areas are code quality, programming languages and using new technologies to provide value.

Microsoft Certified Professional Developer

Microsoft Most Valuable Professional

Month List

bedava tv izle