The theory behind WCF Tracing is essentially the same as a classical definition of tracing. Through tracing an application provides information about itself. Information may vary from the internal state of an object to passed input parameters to a method. This information should be logged, persisted or saved somewhere. WCF Tracing can be used for the instrumentation of the WCF Service. There are essentially four steps involved in WCF Tracing:Emitting Trace information from Service To emit trace information WCF provides different sources. However you have the option to create a trace source using the TraceSource class as well. You can choose any WCF Assembly level trace source to emit the tracing information. WCF Assembly level Trace Sources are as below:
algorithmSuite="Default" establishSecurityContext="true" /> </security> </binding> </wsHttpBinding> </bindings> <client> <endpoint address="http://localhost:2934/Service1.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1" contract="ServiceReference1.IService1" name="WSHttpBinding_IService1"> <identity> <dns value="localhost" /> </identity> </endpoint> </client> </system.serviceModel> <system.diagnostics> <sources> <source name="System.ServiceModel.MessageLogging" switchValue="Information, ActivityTracing"> <listeners> <add name="log" type="System.Diagnostics.XmlWriterTraceListener" initializeData="Traces.svclog"/> </listeners> </source> </sources> <trace autoflush ="true"/> </system.diagnostics></configuration>After configuring as described above when you run the client application you will get a file in:Bin\debug\Traces.svclogOpen that file to view the trace.I hope this post was useful. In a future article I will take you deeper into tracing. Thanks for reading.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: