本文介绍了如何禁用Glimpse,即关闭Glimpse.axd和defaultRuntimePolicy ="Off"之间的区别.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1)通过web.config的设置关闭Glimpse:

1) turning Glimpse off via the web.config's setting:

<glimpse defaultRuntimePolicy="Off" endpointBaseUri="~/Glimpse.axd">

2)通过Glimpse.axd

2) turning it off via Glimpse.axd

据我了解,1)将关闭所有跟踪,而2)将停止将跟踪返回给特定的浏览器会话,但是跟踪仍将在服务器上进行.据我了解,关闭Glimpse(例如对于生产实例)以消除任何Glimpse处理开销的唯一方法是使用1).

As I understand it, 1) will turn off all the tracing whereas 2) will stop the return of the traces to that particular browser session, but tracing will still be happening on the server. As I understand it, the only way to turn Glimpse off, say for a production instance, to remove any Glimpse processing overhead, would be to use 1).

我的理解正确吗?

谢谢

推荐答案

1 的情况下, GlimpseRuntime 将检测到它不应跟踪在任何以下情况下正在进行的操作请求.此值是运行时策略"值,其中Off是最受限制的.请记住,进行该检查仍然会有一些开销.如果要完全删除Glimpse,请确保bin文件夹中没有与Glimpse相关的程序集,并且已从配置中删除已注册的HttpModuleHttpHandler

In case of 1 the GlimpseRuntime will detect that it should not trace actions going on during any of the requests. This value is one of the Glimpse Runtime Policy values of which Off is the most restricted one. Keep in mind that there will still be a little bit of overhead to make that check. If you want to take Glimpse completely out of the picture, then you must make sure there are no Glimpse related assemblies in your bin folder and that the registered HttpModule and HttpHandler are removed from the config

2 的情况下,还将阻止针对 a 特定请求的任何跟踪,这与采用配置值的情况 1 不同所有请求.

In case of 2 it will also prevent any tracing for a particular request, which is different from case 1 where the configuration value applies to all requests.

让我澄清一下. GlimpseRuntime为每个请求确定一个特定的RuntimePolicy值,并基于IRuntimePolicy实现来实现. Glimpse附带了一些现成的策略,其中一些策略决定是否跟踪请求或返回Glimpse客户端作为响应的一部分.他们根据返回的内容类型(例如,当请求图像时不希望返回Glimpse面板),状态代码,使用的uri等来执行此操作,其中之一是 ControlCookiePolicy 可以有效地检查特定的Glimpse Cookie是否是一部分的请求,如果不是这种情况,则将对该特定请求完全禁用跟踪.当您转到Glimpse.axd页面并打开或关闭Glimpse时,基本上就是在创建或删除该Cookie.

Let me clarify that a little bit. The GlimpseRuntime determines a specific RuntimePolicy value for each request and it does that based on IRuntimePolicy implementations. Glimpse comes with a couple of policies out-of-the-box, some decide whether or not to trace requests or to return the Glimpse client as part of the response. They do that based on returning content types (you don't want the Glimpse panel to be returned when an image is requested for instance), the status code, uri used, ... and one of those policies is the ControlCookiePolicy which effectively checks whether a specific Glimpse cookie is part of the request, if that is not the case, tracing will be disabled completely for that particular request. When you go to the Glimpse.axd page and you turn Glimpse on or off, you're basically creating or deleting that cookie.

因此,在 1 的情况下完全不会进行跟踪,但是在 2 的情况下,如果已设置Cookie,则可以对请求A进行跟踪,但是如果Cookie不再存在,可以为请求B禁用.

So in case of 1 no tracing will be done at all, but in case of 2 tracing can be done for request A if the cookie has been set, but can be disabled for request B if the cookie is no longer there.

可以忽略此ControlCookiePolicy并创建自己的策略来确定是否应返回Glimpse Client或进行跟踪,...

It is possible to ignore this ControlCookiePolicy and to create your own policies to determine whether or not the Glimpse Client should be returned or tracing should be done, ...

这篇关于如何禁用Glimpse,即关闭Glimpse.axd和defaultRuntimePolicy ="Off"之间的区别.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-03 20:37