您如何找到可用的调试开关?或者给一个开关找出被禁用的内容? [英] How do you find what debug switches are available? Or given a switch find out what is being disabled?

查看:27
本文介绍了您如何找到可用的调试开关?或者给一个开关找出被禁用的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这个问题中,答案是翻转调试器选择的开关禁用导致问题的无关头.Microsoft 帮助暗示这些开关是用户生成的,未列出任何开关.

<预><代码><配置><系统诊断><开关><add name="Remote.Disable" value="1"/></开关></system.diagnostics></配置>

我想知道的是Remote.Disable"值的来源以及如何找出可以打开或关闭的其他内容.目前它只是一些配置魔法,我不喜欢魔法.

解决方案

正如您所怀疑的,Remote.Disable 会阻止应用程序将调试信息附加到远程请求.它是在发出 SOAP 请求的 .NET 框架方法中定义的.

基本情况是这些开关可以在代码中的任何地方定义,您只需要创建一个新的 System.Diagnostics.BooleanSwitch 并使用给定的名称并且配置文件可以控制它们.

这个特殊的在 System.ComponentModel.CompModSwitches.DisableRemoteDebugging 中定义:

public static BooleanSwitch DisableRemoteDebugging{得到{if (disableRemoteDebugging == null){disableRemoteDebugging = new BooleanSwitch("Remote.Disable", "禁用 Web 方法的远程调试.");}返回禁用远程调试;}}

在您的情况下,它可能是从 System.Web.Services.Protocols.RemoteDebugger.IsClientCallOutEnabled() 调用的,它由 System.Web.Services.Protocols.WebClientProtocol 调用.NotifyClientCallOut 依次被 System.Web.Services.Protocols.SoapHttpClientProtocol

的 Invoke 方法调用

不幸的是,据我所知,没有反编译框架 &寻找

new BooleanSwitch

System.Diagnostics.Switch 类的任何其他继承者,没有简单的方法可以知道定义了哪些开关.好像是具体案例搜索msdn/google/stack overflow的案例

在这种情况下,我只使用了 Reflector &搜索 Remote.Disable 字符串

In this question the answer was to flip on a switch that is picked up by the debugger disabling the extraneous header that was causing the problem. The Microsoft help implies these switched are user generated and does not list any switches.

<configuration>
  <system.diagnostics>
    <switches>
      <add name="Remote.Disable" value="1" />
    </switches>
  </system.diagnostics>
</configuration> 

What I would like to know is where the value "Remote.Disable" comes from and how find out what other things can be switched on or off. Currently it is just some config magic, and I don't like magic.

解决方案

As you suspected, Remote.Disable stops the app from attaching debug info to remote requests. It's defined inside the .NET framework methods that make the SOAP request.

The basic situation is that these switches can be defined anywhere in code, you just need to create a new System.Diagnostics.BooleanSwitch with the name given and the config file can control them.

This particular one is defined in System.ComponentModel.CompModSwitches.DisableRemoteDebugging:

public static BooleanSwitch DisableRemoteDebugging
{
    get
    {
        if (disableRemoteDebugging == null)
        {
            disableRemoteDebugging = new BooleanSwitch("Remote.Disable", "Disable remote debugging for web methods.");
        }
        return disableRemoteDebugging;
    }
}

In your case it's probably being called from System.Web.Services.Protocols.RemoteDebugger.IsClientCallOutEnabled(), which is being called by System.Web.Services.Protocols.WebClientProtocol.NotifyClientCallOut which is in turn being called by the Invoke method of System.Web.Services.Protocols.SoapHttpClientProtocol

Unfortunately, to my knowledge, short of decompiling the framework & seaching for

new BooleanSwitch

or any of the other inheritors of the System.Diagnostics.Switch class, there's no easy way to know what switches are defined. It seems to be a case of searching msdn/google/stack overflow for the specific case

In this case I just used Reflector & searched for the Remote.Disable string

这篇关于您如何找到可用的调试开关?或者给一个开关找出被禁用的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆