If you are using ASP.NET, especially if you are using ASP.NET MVC, you need to be using Glimpse.
I’m currently working on a more exhaustive Pluralsight course on Glimpse, (the course is now live!) but I thought I’d write up a quick getting started tutorial here.
What is Glimpse?
Perhaps you haven’t heard of Glimpse yet, or you are just a little unsure of exactly what it is.
Glimpse is basically an open source and free diagnostics platform for the web. Right now it works best with ASP.NET and especially ASP.NET MVC, but it can be extended to other platforms as well. There is already work started for a PHP version and even a Python port.
Out of the box, Glimpse can show you all kinds of information about your MVC application, like what routes are registered, what the flow was through the MVC pipeline and how the models were bound.
(BTW, if you are looking to brush up on your ASP.NET MVC 4 skills or learn about ASP.NET MVC 4, I recommend Professional ASP.NET MVC 4. Great book, top notch authors.)
Here is what the Glimpse window looks like on a page.
Glimpse is also fully extendable.
There are already plugins for Entity Framework, NHibernate, Ninject and many, many more
The best part about Glimpse is how easy it is to get setup.
I’ll walk you through the steps below.
Step 1: Get Glimpse from NuGet
All you have to do to get Glimpse installed is simply either:
- Open up the Package Manager Console and type “Install-Package Glimpse.Mvc4” (or “Glimpse.AspNet” if you aren’t using MVC)
- Or, right click on your references, select Manage NuGet Packages, then search for Glimpse and find the appropriate Glimpse package.
One you’ve done that, Glimpse will automatically add a few entries to your web.config for you.
Step 2: Turn on Glimpse
Turning on Glimpse is super easy.
Just launch your app and navigate to glimpse.axd. Then, click “Turn Glimpse On” to set a cookie that will tell the Glimpse component running on the server to send you Glimpse data.
Go to glimpse.axd
Turn it on!
It’s that simple!
Step 3: Fire it up
Now all you have to do is navigate to any page in your application and you’ll see this little icon at the bottom right hand corner of the screen:
If you click the icon, you’ll see the Glimpse panel, which currently looks similar to the Chrome Dev Tools panel.
Each tab contains different diagnostics information about your application.
This data can be extremely helpful in troubleshooting problems and learning about exactly what is going on inside of MVC.
You can also find plugins that can be easily installed from NuGet.
For example, if you add the Entity Framework plugin, you’ll start seeing a tab that shows data about EF queries, like this:
I’m pretty excited about Glimpse and its future. Anthony van der Hoorn and Nik Molnar, the two creators and main maintainers for Glimpse, have done an excellent job transforming how we get diagnostics information for web applications.
One of the things I find most exciting about this platform is how easy it is to extend.
In my upcoming Pluralsight course, (the course is now live!) I walk you through creating a Glimpse plugin, which is surprisingly easy.
So if you haven’t checked out Glimpse, what are you waiting for? Go do it now, it will take you about 5 minutes to get setup.
What do you think? Are you using Glimpse already? Post a comment and let me know.
My YouTube video for the week: (This is not an ad!)
And here is the weekly Get Up and Code episode: