visual-studio 如何从 SOAP 消息中删除“VsDebuggerCausalityData”数据?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32877/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 16:24:40  来源:igfitidea点击:

How to remove "VsDebuggerCausalityData" data from SOAP message?

visual-studioweb-servicessoap

提问by Scott Marlowe

I've got a problem where incoming SOAP messages from one particular client are being marked as invalid and rejected by our XML firewall device. It appears extra payload data is being inserted by Visual Studio; we're thinking the extra data may be causing a problem b/c we're seeing "VsDebuggerCausalityData" in these messages but not in others sent from a different client who is not having a problem. It's a starting point, anyway.

我遇到了一个问题,来自一个特定客户端的传入 SOAP 消息被标记为无效并被我们的 XML 防火墙设备拒绝。Visual Studio 似乎正在插入额外的有效负载数据;我们认为额外的数据可能会导致问题 b/c 我们在这些消息中看到“VsDebuggerCausalityData”,但在从没有问题的其他客户端发送的其他消息中看不到。无论如何,这是一个起点。

The question I have is how can the client remove this extra data and still run from VS? Why is VS putting it in there at all?

我的问题是客户端如何删除这些额外的数据并仍然从 VS 运行?为什么VS把它放在那里?

Thanks.

谢谢。

采纳答案by Darryl Braaten

A quick google reveals that this should get rid of it, get them to add it to the web.config or app.config for their application.

一个快速的谷歌显示这应该摆脱它,让他们将它添加到他们的应用程序的 web.config 或 app.config 中。

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

The information is debug information that the receiving service can use to help trace things back to the client. (maybe, I am guessing a little)

该信息是接收服务可以用来帮助将事情追溯到客户端的调试信息。(也许,我有点猜测)

  • I have proposed a follow up questionto determine were the magic switch actually comes from.
  • 我提出了一个后续问题来确定魔术开关实际上来自哪里。

回答by ggrocco

For remove 'VsDebuggerCausalityData' you need stop de Visual Studio Diagnostic for WCF using this command:

要删除“VsDebuggerCausalityData”,您需要使用以下命令停止 de Visual Studio Diagnostic for WCF:

VS 2008 -> c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE>vsdiag_regwcf.exe -u VS 2010 -> c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE>vsdiag_regwcf.exe -u

VS 2008 -> c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE>vsdiag_regwcf.exe -u VS 2010 -> c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE>vsdiag_regwcf.exe -u

I hope this help you or other people.

我希望这对您或其他人有所帮助。

回答by Gone Coding

Based on an answer by @Luiz FelipeI came up with this slightly more robust solution:

根据@Luiz Felipe我的回答,我提出了这个稍微更强大的解决方案:

var vs = client.Endpoint.EndpointBehaviors.FirstOrDefault((i) => i.GetType().Namespace == "Microsoft.VisualStudio.Diagnostics.ServiceModelSink");
if (vs != null)
{
    client.Endpoint.Behaviors.Remove(vs);
}

回答by Jesse Chisholm

Darryl's answer didn't work for me. Each developer has to do ggrocco's answer.

达里尔的回答对我不起作用。每个开发者都要做ggrocco的回答。

I ended up writing a MessageInspector, and adding this code to the BeforeSendRequestmethod:

我最终编写了一个MessageInspector,并将此代码添加到BeforeSendRequest方法中:

int limit = request.Headers.Count;
for(int i=0; i<limit; ++i)
{
    if (request.Headers[i].Name.Equals("VsDebuggerCausalityData"))
    {
        request.Headers.RemoveAt(i);
        break;
    }
}

回答by Poppert

Or use "Start without debugging" in Visual Studio.

或者在 Visual Studio 中使用“不调试启动”。