Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Glimpse + MVC5 + Sitecore 7.2

I have an ASP.NET MVC5 website and I have installed Glimpse.MVC5 using nuget. The website is running the latest version of the Sitecore CMS (7.2 rev. 140314). I haven't changed the Glimpse configuration at all apart from adding logging.

When I go to the homepage of the website (after enabling Glimpse) I can't see the HUD. The following is the last line in the Glimpse log:

2014-04-24 15:19:01.6043 | DEBUG | Apparently GlimpseRuntime has not yet initialized this request. This might happen in case you're doing something specific like mentioned in this issue: https://github.com/Glimpse/Glimpse/issues/703 . Either way, Glimpse will be disabled to prevent any further non-deterministic behavior during this request.

I've had a look at the link but I can't see that it applies to my situation. There are no NullReferenceException's in the log.

I have tested Glimpse.MVC5 with a vanilla ASP.NET MVC5 website on my machine and that worked fine so I'm tempted to assume that it's something to do with Sitecore.

Any ideas what could be wrong or ideas on how to identify the issue?

like image 749
Christian Hagelid Avatar asked Jan 10 '23 17:01

Christian Hagelid


2 Answers

The solution mentioned in this post on the Glimpse issue tracker solved the problem.

Sitecore does it's own HttpModule stuff which seems to cause issues.

In order to fix this, you need to move the Glimpse HttpModule definition before the Sitecore modules in the Web.config.

like image 111
Christian Hagelid Avatar answered Feb 03 '23 08:02

Christian Hagelid


The reason why you are still not seeing the HUD is explained by that log message as well.

Somehow during the execution of the request, a new HttpContext is created or used which means you'll loose the request initialization that Glimpse did at BeginRequest. As part of that initialization, items are being stored in the HttpContext.Items collection for which Glimpse will look during request monitoring.

The message you see in the log is an example of when Glimpse wants to know what the current RuntimePolicy is, so that it knows whether or not it should continue to monitor that request. The current RuntimePolicy is set by Glimpse during the BeginRequest phase of that request and the log now indicates it cannot find it, after which Glimpse decides to be concervative and stop monitoring that request instead of ending in a NullReferenceException

Now the cases where we've seen that (check the linked issues inside the issue you mentioned) is when another HttpContext is being created and used to process that request after that Glimpse did is initialization.

So the only advice I can give here, is to check whether the creation of another HttpContext is actually the case for you? You might find some ideas in those linked issues.

In case you find something specific that is not related to the issue mentioned above, then I would suggest you create a new issue on our issue tracker as it is a more appropriate place to discuss potential bugs or missing features

like image 30
cgijbels Avatar answered Feb 03 '23 06:02

cgijbels