none
Tracing WCF Service log RRS feed

  • Question

  • I have a service and I want to trace it.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.ServiceModel.Activation;
    using System.ServiceModel;
    
    namespace service
    {
        [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
        [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
        public class wservice:Iwservice
        {
            public string RunTts(string value)
            {
                // blah blah
                    return "";
                }
            }
        }
    }
    
    How can I trace the service? In my web.config, I have
    <system.diagnostics>
        <sources>
          <source name="System.ServiceModel" switchValue="Information,ActivityTracing"
            propagateActivity="true">
            <listeners>
              <add name="xml" />
            </listeners>
          </source>
          <source name="System.ServiceModel.MessageLogging">
            <listeners>
              <add name="xml" />
            </listeners>
          </source>
        </sources>
        <sharedListeners>
          <add initializeData="C:\TracingAndLogging-service.svclog" type="System.Diagnostics.XmlWriterTraceListener"
            name="xml" />
        </sharedListeners>
        <trace autoflush="true" />
    </system.diagnostics>
    Thanks.

    Wednesday, July 10, 2013 6:37 PM

Answers

All replies