Jeff Sanders Technical Blog

I am a Microsoft employee that has worked on all aspects of the Web Stack for a long time. I hope these blogs are useful to you! Use this information at your own risk.


<< Go Back

How To Enable Winhttp Tracing On Vista 2008 And Windows 7

- 28 May 2009

WinhttpTracecfg.exe for Vista does not exist, so how can you get a WinHttp trace in Vista and above?

WinHttpTraceCfg.exe has been replaced in Vista and above with the netsh winhttp command.
see this blog:
http://blogs.msdn.com/wndp/archive/2007/03/21/winhttp-configuration-for-windows-vista.aspx

NOTE:  For 32 bit tracing on a 64 bit system you need to use the 32 bit netsh from the SysWOW64 directory.  This goes for proxy settings as well!  This netsh is located in the C:\Windows\SysWOW64 directory (if you did a default install).

A typical command to enable full tracing for WinHttp would look like this:

C:\Windows\system32>netsh winhttp set tracing trace-file-prefix=”C:\Temp\WinHttpLog” level=verbose format=hex state=enabled

For a 32 bit process on a 64 bit OS it would be from the SysWOW64 dir like this:

C:\Windows\SysWOW64>netsh winhttp set tracing trace-file-prefix=”C:\Temp\WinHttpLog” level=verbose format=hex state=enabled

You would reproduce the issue and then turn off tracing like this:

C:\Windows\system32>netsh winhttp set tracing state=disabled

 This would leave the other parameters you set previously to remain so the next time you want to enable tracing simply type:

C:\Windows\system32>netsh winhttp set tracing state=enabled

 

Other parameters are available:

C:\Windows\system32>netsh winhttp set tracing

will show you the options:

Usage:  set tracing
        [output=]file|debugger|both
        [trace-file-prefix=]         [level=]default|verbose         [format=]ansi|hex         [max-trace-file-size=]         [state=]enabled|disabled

Parameters:

  Tag                   Value
  trace-file-prefix   – Prefix for the log file (can include a path)
                        specify “*” to delete an existing prefix
  output              – Where the trace entries are written/displayed to
  level               – How much information to log
  format              – Display format of network traffic (hex or ansi)
  max-trace-file-size – Maximum size of the trace file (in bytes)
  state               – Enables or disables winhttp tracing

Examples:

  set tracing trace-file-prefix=”C:\Temp\Test3″ level=verbose format=hex
  set tracing output=debugger max-trace-file-size=512000 state=enabled

You can display the existing settings with this command:

C:\Windows\system32>netsh winhttp show tracing

Current WinHTTP Tracing settings:

    Tracing is not enabled.

    Trace File Prefix: C:\Temp\Test3
    Trace Output: file
    Trace Level:  verbose (headers, APIs, and entity body)
    Network Traffic Format: hex
    Maximum size of trace file (in bytes): 65535

Let me know if this helps!

<< Go Back