1

我正在尝试将 Glimpse 用于 MVC 4。我的问题是,尽管我已按照Glimpse 站点上的安装说明进行操作,但 Glimpse 图标并未出现在我的站点上。

基本上我创建了一个新的 MVC 4 项目并添加了 NuGet 包 Glimpse.MVC4。这是我的 web.config 文件:

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <section name="glimpse" type="Glimpse.Core.Configuration.Section, Glimpse.Core" />
  </configSections>
  <appSettings>
    <add key="webpages:Version" value="2.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>
  <system.web>
    <httpRuntime targetFramework="4.5" />
    <compilation debug="true" targetFramework="4.5" />
    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
      </namespaces>
    </pages>
    <!-- Glimpse: This can be commented in to add additional data to the Trace tab when using WebForms
        <trace writeToDiagnosticsTrace="true" enabled="true" pageOutput="false"/> -->
    <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>
    <handlers>
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
      <add name="Glimpse" path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet" preCondition="integratedMode" />
    </handlers>
    <validation validateIntegratedModeConfiguration="false" />
    <modules>
      <add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" preCondition="integratedMode" />
    </modules>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
    <!-- If you are having issues with Glimpse, please include this. It will help us figure out whats going on. -->
      <logging level="Trace" />
  </glimpse>
</configuration>

当我运行我的网站时,我导航到http://localhost:12345/glimpse.axd并单击该Turn On Glimpse按钮,该按钮看起来会在我的网站上创建一个 cookie(我通过 Chrome 开发人员工具栏看到)。当我导航回页面时,http://12345我没有看到页面右下角出现任何图标,如说明中所述。

我查看了有关此场景的各种 StackOverflow 问题,但很多都提到了旧/Glimpse/Config的做事方式。由于我没有做任何不寻常的事情,我想知道我是否错过了一步?

编辑:

嗯,我没有注意到我打开了日志记录。好的,现在事情更清楚了:

2013-04-02 21:42:09.5624 | DEBUG | get_Binders method of type 'System.Web.Mvc.Async.AsyncControllerActionInvoker' is not proxyable. | 
    2013-04-02 21:42:09.5624 | DEBUG | set_Binders method of type 'System.Web.Mvc.Async.AsyncControllerActionInvoker' is not proxyable. | 
    2013-04-02 21:42:09.5624 | DEBUG | Methods inspected via proxy generation hook on type 'System.Web.Mvc.Async.AsyncControllerActionInvoker'. | 
    2013-04-02 21:42:09.6064 | DEBUG | Methods inspected via proxy generation hook on type 'System.Web.Mvc.IActionFilter'. | 
    2013-04-02 21:42:09.6064 | DEBUG | Methods inspected via proxy generation hook on type 'System.Web.Mvc.IResultFilter'. | 
    2013-04-02 21:42:09.6064 | DEBUG | Methods inspected via proxy generation hook on type 'System.Web.Mvc.IAuthorizationFilter'. | 
    2013-04-02 21:42:09.6064 | DEBUG | Methods inspected via proxy generation hook on type 'System.Web.Mvc.IExceptionFilter'. | 
    2013-04-02 21:42:09.6064 | DEBUG | Methods inspected via proxy generation hook on type 'System.Web.Mvc.IExceptionFilter'. | 
    2013-04-02 21:42:09.6364 | DEBUG | Methods inspected via proxy generation hook on type 'System.Web.Mvc.IValueProvider'. | 
    2013-04-02 21:42:09.6364 | DEBUG | Methods inspected via proxy generation hook on type 'System.Web.Mvc.IUnvalidatedValueProvider'. | 
    2013-04-02 21:42:09.6364 | DEBUG | Methods inspected via proxy generation hook on type 'System.Web.Mvc.IValueProvider'. | 
    2013-04-02 21:42:09.6364 | DEBUG | Methods inspected via proxy generation hook on type 'System.Web.Mvc.IUnvalidatedValueProvider'. | 
    2013-04-02 21:42:09.6504 | DEBUG | Methods inspected via proxy generation hook on type 'System.Web.Mvc.IValueProvider'. | 
    2013-04-02 21:42:10.0504 | DEBUG | Methods inspected via proxy generation hook on type 'System.Web.Mvc.IView'. | 
    2013-04-02 21:42:10.0504 | INFO | Replaced IView of type 'System.Web.Mvc.RazorView', named 'Index', with proxy implementation. | 
    2013-04-02 21:42:10.2524 | WARN | Unable to locate '</body>' with content encoding 'Unicode (UTF-8)'. Response may be compressed. | 
    2013-04-02 21:42:13.6916 | DEBUG | RuntimePolicy set to 'ExecuteResourceOnly' by IRuntimePolicy of type 'Glimpse.Core.Policy.GlimpseResourcePolicy' during RuntimeEvent 'ExecuteResource'. | 
    2013-04-02 21:42:15.0587 | DEBUG | RuntimePolicy set to 'ExecuteResourceOnly' by IRuntimePolicy of type 'Glimpse.Core.Policy.GlimpseResourcePolicy' during RuntimeEvent 'ExecuteResource'. | 
    2013-04-02 21:42:17.4918 | INFO | Replaced IView of type 'System.Web.Mvc.RazorView', named 'Index', with proxy implementation. | 
    2013-04-02 21:42:17.4918 | WARN | Unable to locate '</body>' with content encoding 'Unicode (UTF-8)'. Response may be compressed. | 
4

1 回答 1

3

我只是<body>在 HTML 中丢失了一个标签。一旦我添加了缺少的标签,该图标就会出现。

于 2013-04-02T20:45:48.140 回答