gpt4 book ai didi

.net - 您如何找到可用的调试开关?或者给一个开关找出被禁用的内容?

转载 作者:行者123 更新时间:2023-12-04 15:27:08 25 4
gpt4 key购买 nike

在此 question答案是打开调试器拾取的开关,禁用导致问题的无关 header 。 Microsoft 帮助暗示这些开关是用户生成的,并未列出任何开关。

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

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

最佳答案

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

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

这个特殊的在 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;
}
}

在您的情况下,它可能是从 System.Web.Services.Protocols.RemoteDebugger.IsClientCallOutEnabled() 调用的,它由 System.Web.Services.Protocols.WebClientProtocol.NotifyClientCallOut 调用,而 System.Web.Services.Protocols.WebClientProtocol.NotifyClientCallOut 又由 System 的 Invoke 方法调用.Web.Services.Protocols.SoapHttpClientProtocol

不幸的是,据我所知,缺乏反编译框架和搜索
new BooleanSwitch

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

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

关于.net - 您如何找到可用的调试开关?或者给一个开关找出被禁用的内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33334/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com