3

I have an MVC 4 application built on top of EPiServer 7.1. EPiServer uses StructureMap as it's IoC framework, which may be related to my problems. Anyhow, this is what I have done:

  1. Via "Manage Nuget Packages...", added "Glimpse Mvc4" to my project
  2. Verified that web.config was updated as expected
  3. Restarted my application

After adding Glimpse, all requests fail with a NullReferenceException, e.g., like this:

sample error

I have tried enabling Glimpse logging by commenting in 'logging level="Trace"' in the Glimpse-section of web.config, but can't find any logging in neither Windows event logs or log4net log files.

Ideas on how to troubleshoot further, or hints to a solution?

Community
  • 1
  • 1
Thomas Svensen
  • 760
  • 1
  • 7
  • 14
  • Glimpse logs should appear in a `glimpse.log` file in the root folder of your site. I haven't tried Glimpse with EPiServer 7.1 yet, I'll try and have a look at this later today. – PhilPursglove Jun 19 '13 at 13:24
  • Thank you for the feedback. Yes, I found the `glimpse.log` file new, but it didn't give any hints - just the normal `DEBUG` and `INFO` messages. – Thomas Svensen Jun 20 '13 at 11:46

2 Answers2

5

A workaround (thanks to @avanderhoorn!) is to add this to the "glimpse" section of web.config:

<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
      <tabs>
        <ignoredTypes>
          <add type="Glimpse.AspNet.Tab.Routes, Glimpse.AspNet"/>
        </ignoredTypes>
      </tabs>
    <inspectors>
        <ignoredTypes>
            <add type="Glimpse.AspNet.Inspector.RoutesInspector, Glimpse.AspNet"/>
            <add type="Glimpse.Mvc.Inspector.ModelBinderInspector, Glimpse.Mvc4"/>
        </ignoredTypes>
    </inspectors>
</glimpse>

This disables the two parts of Glimpse that break with EPiServer. As far as I can see, you still get the most useful parts available!

Thomas Svensen
  • 760
  • 1
  • 7
  • 14
  • Just realized that EpiServer CMS Find plugin does not function correctly as well. Unable to cast object of type 'Castle.Proxies.IViewProxy_1' to type 'System.Web.Mvc.WebFormView'. – wałdis iljuczonok Jul 02 '13 at 20:29
0

+1 the same here. What I found so far is that by adding Glimpse it augments all routes and replaces with it's own proxy classes for intercepting calls to routing. EPiServer (and UrlResolver in particular) seems that don't like this case. The root cause for this exception is following method:

UrlResolver.GetVirtualPath(ContentReference contentLink, string language, RouteValueDictionary routeValues, RequestContext requestContext)

What it doesn't like is fact that there is no route of type ContentRoute in the routing table:

foreach (RouteBase base2 in from r in this._routes
where (bool) (r is ContentRoute)
select r)
{
   ...
   if(...)
   {
       return virtualPath;
   }
}

return null;

And after returning null to the caller NullReferenceExpcetion occours in:

UrlExtensions.MapUrlFromRoute(RequestContext requestContext, RouteCollection routeCollection, string url)

Seems like patch from EPiServer should be awaited.

  • Hi Valdis! Thanks for the update - I just realized exactly the same, and was about to update my question when I saw your reply. I guess we are dependent on EPiServer making a change - it would be nicer to do it on the Glimpse-side, as that is open-source. But I doubt there is a simple way to update Glimpse to handle this. – Thomas Svensen Jun 25 '13 at 07:53