WCF ETW Tracing

"Hello World"!

Today I would like to share a quick way to enable and collect WCF tracing, machine wide, without any configuration change!

We are all used to enable WCF diagnostic tracing using the application/web configuration file (leveraging our friend System.Diagnostics.XmlWriterTraceListener). But WCF uses also ETW for tracing, so we have a second option! The ETW provider used is called "Microsoft-Windows-Application Server-Applications".
You can easily enable the tracing and convert the result to an human-readable text file with:

  • logman start WCFETWTracing -p "Microsoft-Windows-Application Server-Applications" -nb 256 1024 -bs 512 -ets -ct perf -f bincirc -max 500 -o mywcftrace.etl
  • …execute the program…
  • logman.exe stop WCFETWTracing –ets
  • netsh trace convert input=mywcftrace.etl wcf_repro.txt TXT

If you prefer to use powershell check the following script

Please note that this ETW tracing is machine wide! If you want to collect the data only for one process you may use other methods/tools like Perfview.

Last but not least, this tracing can also be enabled through the event viewer: Application Server-Applications / Debug and Analytic logs