简体   繁体   English

如何在WCF跟踪中查看SOAP请求和响应

[英]How to see SOAP Request and Response in WCF Tracing

I have enabled SwitchValue = All, and also Activity and Information. 我启用了SwitchValue = All,还启用了Activity和Information。

Also enabled Messaging. 还启用了消息传递。

Still no luck, I couldn't get to see the soap request and response. 还是没有运气,我看不到肥皂的要求和回应。 Some instance I do see the exception or message. 在某些情况下,我确实看到了异常或消息。

I want to see "All inputs" values which is soap request. 我想查看“所有输入”值,即肥皂请求。 And also SOAP Response. 还有SOAP响应。 What is that I am missing? 我想念的是什么?

reference 参考

This is what I use in my web config: 这是我在Web配置中使用的:

add this or a variation thereof to the system.servicemodel node: 将其或其变体添加到system.servicemodel节点:

<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>

Try to add the following configuration to the web.config. 尝试将以下配置添加到web.config。

    <system.diagnostics>
    <sources>
      <source name="System.ServiceModel.MessageLogging">
        <listeners>
          <add type="System.Diagnostics.XmlWriterTraceListener" name="xmlLog" initializeData="myLogs.svclog"/>
        </listeners>
      </source>
    </sources>
  </system.diagnostics>
  <system.serviceModel>
    <diagnostics>
      <messageLogging logEntireMessage="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="false" />
    </diagnostics>
  </system.serviceModel>

Feel free to let me know if the problem still exists. 随时让我知道问题是否仍然存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM