How to see SOAP Request and Response in WCF Tracing

回眸只為那壹抹淺笑 提交于 2019-12-24 08:06:33

问题


I have enabled SwitchValue = All, and also Activity and 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. What is that I am missing?


回答1:


reference

This is what I use in my web config:

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>



回答2:


Try to add the following configuration to the 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.



来源:https://stackoverflow.com/questions/53692319/how-to-see-soap-request-and-response-in-wcf-tracing

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!