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 Take A System Net Trace From Windows Store Applications Developer Preview

- 16 Dec 2011

In desktop applications and services we frequently take System.Net traces to diagnose issues using the HttpWebRequest class, HttpListener, sockets, smpt etc… (and now the HttpClient classes).  We traditionally use the application configuration file (appname.exe.config) to enable the tracing.  The config file is read and the tracing parameters are used to trace the information we find useful.   Windows Store applications do not have configuration files however so you cannot use the application configuration file to take the trace.

The good news is that you can go further up and put your tracing settings in the machine.config file!  The one minor issue is that any process using system.net will be included in the trace file if it starts after you make the change.  If you use my trace file it logs the process and time so you can use that to filter the trace information see: My Favorite System.Net trace configuration file dumps Process ID and Date Time Information .

Here are the steps:

You will be making changes to the machine.config file.  If you mess this up, you could keep .NET framework applications from running so be SURE you make a copy of the file that you can restore after you have gotten your trace!  If you are using a 64 bit build you make the config changes in the Framework64 tree.

a. Right click on the c:\temp folder and select properties
b. Click on the security tab
c. Hit the Edit button
d. Hit the Add button
e. Hit the Locations… button and change the location to the very top item (the name of your computer)
f. In the space below Enter the object names to select add ALL APPLICATION PACKAGES and hit Check Names
g. Hit OK and check Allow, Full control for the ALL APPLICATION PACKAGES and then hit OK again to apply your changes

  1. Start your application and recreate the issue you wish to trace, and close your application
  2. Restore the machine.config file from the copy you created in step 1

You can then analyze the trace as you would in the past!

Please let me know if you have found this useful or have any questions.

<< Go Back