I have finally got around to getting Glimpse working with XAF. Glimpse is an amazing extensible ASP.NET plug-in which gives you valuable information about what is going on within your server in production. It’s also very pretty.
Let’s jump right in and have a look at what XAF looks like with Glimpse running.
That banner along the bottom of the screen is the Glimpse heads up display (HUD). Hovering over various sections of it pops up more information:
If you click on the Glimpse icon in the bottom right, you get even more goodies. Here’s the Timeline view.
And there are many other tabs available. The Configuration tab shows the contents of the web.config file.
Here’s the Control Tree tab:
The Page Life Cycle tab:
The Request tab:
The Session tab:
And the Trace tab including the DevExpress log items that were added to the trace during this page load:
As you can see, this is a very valuable glimpse into the server which can be turned on as needed in production.
Adding Glimpse to an XAF application
First install the Glimpse Nuget package into the project.
The Nuget installation will make various incorrect changes to the web.config. The corrected sections are below:
Next, there is an outstanding problem with the current release version of the Glimpse ASP.NET NuGet package (1.6.0) which prevents it from working with the development webserver. (Apparently it’s fixed in 1.7.0 which should be released soon). If you try to run MainDemo.Web you will get the following error:
Type 'System.Web.HttpContextWrapper' in assembly 'System.Web, Version=22.214.171.124, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable.
However it works fine against IIS Express (or full IIS). Go to the MainDemo.Web and change the debug properties as follows:
Then run the web application. Glimpse is off by default. In order to turn it on, you need to set a cookie, which you can do by navigating to Glimpse.axd. This is the Glimpse configuration screen.
Additional Glimpse extensions
Glimpse is extensible and there are many additional plugins available. Many of these take the form of additional tabs with details about a particular aspect of your application: SQL Queries, Elmah errors, ASP.NET caching, logging, dependency injection, etc.
MainDemo Sample Project
I have uploaded a modified XAF MainDemo to this GitHub repository with all the above changes. (Don’t forget to debug against IIS Express).