How to use tracing with the RC version of Windows Web Services

Tracing in Windows Web Services uses Event Tracing to let you know about what happens inside the WWS runtime after your code calls into the API. Tracing is available on all versions of Windows we support (XP, Vista, 2003, 2008 and 7). In case of Windows 7, once you install Windows 7 Release Candidate and Windows SDK for Windows 7 RC, you can use tracing to troubleshoot communication issues in your applications that use WWS. Traces are logged for major events like entry and exit into Ws*() function; any runtime errors including SOAP faults; start and completion of any I/O and SOAP messages sent and received (not available on Windows XP). There are three levels of tracing. In verbose mode, the runtime saves traces for all events. In Info mode, it only saves informational traces such as start and completion of I/O. In error mode, only errors are logged. Windows SDK for Windows 7 RC contains a batch script called wstrace.bat. This batch file provides a convenient way to:

  • Create and delete a trace log
  • Enable and disable tracing
  • Update the tracing level (info/error/verbose)
  • Converting trace logs to CSV files

A typical sequence of commands for collecting traces is as follows:

1. Run Windows SDK CMD Prompt as administrator.

2. To create trace log run the following command. The third parameter indicates the mode of tracing you are going to use. In the example below, I set Verbose mode.

> wstrace.bat create verbose

3. Enable tracing

> wstrace.bat on

4. Start dumping of tracing messages to a file

> wstrace.bat dump > C:\Temp\wwstraces.csv

5. Switch to your application and run your scenario

6. Switch to the command prompt and press Ctrl+C. This should stop tracing and wstrace batch file

7. Turn off tracing

> wstrace.bat off

8. Delete tracing log

> wstrace.bat delete

Once you are done, you can open .csv file in Excell. Each event trace is saved in one row. You can sort by process ID to separate events from different clients and services. The logs are usually self-explanatory and they should point out the root cause of an issue.

To learn more about tracing options available to you, run wstrace.bat without any commands. It will print out all different options supported by the tracing. Check out this section in MSDN documentation for more details on tracing and commands for wstrace.bat. Try it out and if you have any feedback, please leave comments or ask questions on the forum.