Question

After following all the guides, SO pages and troubleshooting pages I can find I'm finally out of ideas.

I've got Glimpse working fine on my local dev server, but when I deploy my ASP.net (MVC5) app to my remote server it doesn't work - at all. /glimpse.axd gives a 404 with both LocalPolicy and ControlCookiePolicy set to ignore, and with a custom security policy that returns On in all cases. My understanding is that with ControlCookiePolicy disabled, I shouldn't need to go to /glimpse.axd to enable it - but I'm not seeing the glimpse icon on the remote server either.

Even if I go to the remote server and browse localhost to /glimpse.axd I still get a 404.

My web.config looks like this:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
    <section name="glimpse" type="Glimpse.Core.Configuration.Section, Glimpse.Core" />
</configSections>

<system.web>
    <compilation debug="false" />
    <httpRuntime targetFramework="4.5.1" relaxedUrlToFileSystemMapping="true" />
</system.web>

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
        <remove name="FormsAuthentication" />
    </modules>

    <urlCompression doDynamicCompression="true" dynamicCompressionBeforeCache="false" />
</system.webServer>

<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
    <logging level="Trace" />
    <runtimePolicies>
        <ignoredTypes>
            <add type="Glimpse.AspNet.Policy.LocalPolicy, Glimpse.AspNet" />
            <add type="Glimpse.Core.Policy.ControlCookiePolicy, Glimpse.Core" />
        </ignoredTypes>
    </runtimePolicies>
</glimpse>
</configuration>

This is the version off the remote server (after transform). I've trimmed it a little to remove sections like appSettings.

My GlimpseSecurityPolicy.cs looks like this:

// Uncomment this class to provide custom runtime policy for Glimpse

using Glimpse.AspNet.Extensions;
using Glimpse.Core.Extensibility;

namespace RationalVote
{
public class GlimpseSecurityPolicy:IRuntimePolicy
{
    public RuntimePolicy Execute(IRuntimePolicyContext policyContext)
    {
        return RuntimePolicy.On;
    }

    public RuntimeEvent ExecuteOn
    {
        // The RuntimeEvent.ExecuteResource is only needed in case you create a security policy
        // Have a look at http://blog.getglimpse.com/2013/12/09/protect-glimpse-axd-with-your-custom-runtime-policy/ for more details
        get { return RuntimeEvent.EndRequest | RuntimeEvent.ExecuteResource; }
    }
}
}

The real one does an actual check, but I get the same issue with the policy above.

I cannot seem to find any trace output anywhere on the remote server, it is logging fine on my local machine.

I am deploying using the Visual Studio publish to web feature, and I've verified that the Glimpse.Core.dll is in the bin folder.

I can't see anything in the event log that is relevant.

I've also added <add namespace="Glimpse.Mvc.Html" /> to the namespaces block of the web.config in the views folder.

I tried putting @Html.GlimpseClient() in the _Layout.cshtml file just above </body> but this renders nothing.

Anybody got any ideas?

Was it helpful?

Solution

If the glimpse.axd is returning a 404 then this means the Glimpse resource handler is not registered.

If the web.config content you show above is not trimmed to much, then it is normal that Glimpse won't do much as the Glimpse HttpModule and the Glimpse HttpHandler are not registered in the system.web and/or the system.webserver sections like this

<system.web>
    <httpModules>
        <add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet"/>
    </httpModules>
    <httpHandlers>
        <add path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet"/>
    </httpHandlers>
</system.web>
<system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules>
        <add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" preCondition="integratedMode"/>
    </modules>
    <handlers>
        <add name="Glimpse" path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet"  preCondition="integratedMode" />
    </handlers>
</system.webServer>

Maybe your transform removed to much from the local web.config?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top