How to configure SERVICE TRACE VIEWER in WCF?

Configuring Service trace viewer can be very easily done.

Add the following section in the web.config file to setup trace viewer

1. Add diagnostics section inside system.serviceModel

<diagnostics>
      <messageLogging
logEntireMessage="truelogMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxMessagesToLog="2147483647" maxSizeOfMessageToLog="2147483647" /></diagnostics>

2. Add diagnostics section inside configuration

<system.diagnostics>
    <sources>
      <source name="System.ServiceModel.MessageLogging" switchValue="Information,ActivityTracing">
        <listeners>
          <add name="ServiceModelMessageLoggingListener">
            <filter type=""/>
          </add>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add initializeData="d:\Messages.svclog" type="System.Diagnostics.XmlWriterTraceListener" name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
        <filter type=""/>
      </add>
    </sharedListeners>
    <trace autoflush="true"/>
  </system.diagnostics>

And that is it. It is ready. You don't need to do anything else. Run the service and can check the log.

Comments

Popular posts from this blog

SQL Interview Questions and Answers

Generic Interface and Factory Pattern in C#

How to get device info IMEI programmatically in xamarin android