Sunday, September 15, 2013

Glimpse - ASP.NET Debugging

As the name suggests Glimpse allows you to glimpse into what is happening on server side of your ASP.NET application. It can save you lot of time whilst debugging by providing plethora of information and also help you learn and understand the internal mechanics of ASP.NET.

You can install Glimpse using Nuget. Ensure you install the right packages for ASP.NET and the features you want use.

You can also use the package manager console to install Glimpse

install-package Glimpse.MVC4
install-package Glimpse.EF5

Glimpse is quite extensible and there are many other packages available from the community.

Once you have installed the packages required for your project, you need to turn on Glimpse by going to http://yourproject:port/Glimpse.axd

Now you can see stats from Glimpse hud in the bottom right corner of your application.

You basically turn Glimpse on and off with cookies, it does not run in background. You can setup security policy to control when you want to use it. For example, locally when debugging or with a specific cookie value, or your authorization role, or parent switch in the web.config.

The Glimpse view is inspired from developer tools like fire bug. The great thing about it is that each tab is a plugin itself and is all built with CSS and javascript.

You can see all the information from your Configuration file like your connection strings. Information on what environment the application is running on. Even SQL queries being run by entity framework and the time taken for them to complete.

Since the server is collecting information on all sessions, you can pull out a popup browser window of Glimpse and connect to sessions from other browsers. For example, you could debug a session for a customer remotely whilst they are performing actions.

I think it is a great tool which should be used in every ASP.NET project. You should watch this great introduction video on Glimpse site by Anthony and Nick.

No comments:

Post a Comment