Debug .NET Portlets with trace.axd

Development by matt on June 9th, 2007 No Comments

There are lots of ways to debug .NET applications, from tunneling tools to stepping through code. Another neat way to keep track of requests to your application is to use Application-Level Trace Logging. Once turned on, you can view a list of requests and other trace information by going to the URL http://iisserver/webservicepath/Trace.axd, and getting the following:

trace.axd

The "View Details" link brings back a huge amount of information about the request headers and other important .NET information, including trace messages written into your code, which can be instrumental in diagnosing problems with your portlet.


You turn on Trace Logging in the web.config file:

<trace>
enabled="true"
requestLimit=”50″
pageOutput=”false”
traceMode=”SortByTime”
localOnly=”true”
</trace>

… and you can write debug messages out the trace file with:

System.Diagnostics.Trace.Write("Page is loading");

For more details, check out the Microsoft MSDN page.

No Responses to “Debug .NET Portlets with trace.axd”

Leave a Reply

You must be logged in to post a comment.