如何在 WCF 跟踪中查看 SOAP 请求和响应 [英] How to see SOAP Request and Response in WCF Tracing

查看:23
本文介绍了如何在 WCF 跟踪中查看 SOAP 请求和响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已启用 SwitchValue = All,以及活动和信息.

I have enabled SwitchValue = All, and also Activity and Information.

还启用了消息功能.

仍然没有运气,我无法看到肥皂请求和响应.在某些情况下,我确实看到了异常或消息.

Still no luck, I couldn't get to see the soap request and response. Some instance I do see the exception or message.

我想查看soap请求的所有输入"值.还有 SOAP 响应.我错过了什么?

I want to see "All inputs" values which is soap request. And also SOAP Response. What is that I am missing?

推荐答案

参考

这是我在我的网络配置中使用的:

This is what I use in my web config:

将此或其变体添加到 system.servicemodel 节点:

add this or a variation thereof to the system.servicemodel node:

<diagnostics wmiProviderEnabled="true">
  <messageLogging
       logEntireMessage="true"
       logMalformedMessages="true"
       logMessagesAtServiceLevel="true"
       logMessagesAtTransportLevel="true"
       maxSizeOfMessageToLog="102400000"
       maxMessagesToLog="10000" />
</diagnostics>

然后添加这个节点(你不必使用不需要的错误日志部分):

Then add this node (you don't have to use the error logging part is not needed):

<system.diagnostics>
    <trace autoflush="true" />
    <sources>
        <source name="DefaultSource" switchName="DefaultSwitch">
            <listeners>
                <add name="FileLog"/>
            </listeners>
        </source>
        <source propagateActivity="true" name="System.ServiceModel" switchValue="Warning">
            <listeners>
                <add type="System.Diagnostics.DefaultTraceListener" name="Default">
                    <filter type="" />
                </add>
                <add name="ServiceModelTraceListener">
                    <filter type="" />
                </add>
            </listeners>
        </source>
        <source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing">
            <listeners>
                <add type="System.Diagnostics.DefaultTraceListener" name="Default">
                    <filter type="" />
                </add>
                <add name="ServiceModelMessageLoggingListener">
                    <filter type="" />
                </add>
            </listeners>
        </source>
    </sources>
    <switches>
        <add name="DefaultSwitch" value="Information" />
    </switches>
    <sharedListeners>
        <add initializeData="C:\logs\TraceLogs\Web_tracelog_messages.svclog"
            type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
            <filter type="" />
        </add>
        <add initializeData="C:\logs\TraceLogs\Web_tracelog_errors.svclog"
          type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
          name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
            <filter type="" />
        </add>
        <add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="something.web"/>
    </sharedListeners>
</system.diagnostics>

这篇关于如何在 WCF 跟踪中查看 SOAP 请求和响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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