Over a million developers have joined DZone.

Advanced ASP.NET Trace Viewer

DZone's Guide to

Advanced ASP.NET Trace Viewer

In this article, you'll learn how to get to the bottom of code performance issues using ASP.NET tracing, and a free tool that helps make tracing easier.

· Performance Zone ·
Free Resource


What did my code just do? That is a critical question that developers always need to know. Application logging, tracing, and profiling are the primary ways that developers can answer this question. In this article, we’ll review ASP.NET tracing and how to view your tracing statements with Prefix.

Intro to ASP.NET Tracing

Tracing is built into the .NET framework and has been available for years. Microsoft describes ASP.NET tracing as a way to view diagnostic information about a single request. It lets you see the page’s execution path, web request details, and much more.





      <add name="WebPageTraceListener"

How to Write Traces

By default, ASP.NET collects a lot of details like cookies, headers, response status code, and more. These basics can be very helpful, but being able to see your own tracing statements is even more valuable. You can log them as multiple tracing levels. Including warnings, information, error, and just trace.


public async Task<HttpResponseMessage> KitchenAsync()
Trace.WriteLine("Starting KitchenAsync - Call redis");
await SERedisAsync();
Trace.WriteLine("Call DB");
await DBTestAsync();
Trace.WriteLine("Call Webclient");
await WebClientAsync();
Trace.WriteLine("Finished KitchenAsync");

Viewing ASP.NET Traces


This will load a list of the most recent web requests.

Image title

View ASP.NET Traces via Trace

By clicking “View Details” you can view what is captured for a specific web request. Here is an example of the one from the C# code above. You can see the Trace.WriteLine messages that were logged.

Image title

ASP. NET Trace Detail

ASP.NET Trace Viewer With Prefix


What is Prefix?

Prefix is a free developer tool from Stackify. It is installed on your workstation and runs as a lightweight ASP.NET profiler. It tracks key methods being called by your code and provides an excellent user interface to view .NET traces, logs, SQL queries, exceptions, and much more.

Prefix automatically tracks hundreds of key methods across dozens of common frameworks and dependencies. Things like SQL Server, MongoDB, Redis, etc. To view a complete list of what Prefix tracks, please visit our docs.

View ASP.NET Traces

Prefix collects a lot of similar details as the standard ASP.NET trace view. It also includes way more details. Not only does it automatically pick up the Trace.WriteLine statements, it also supports Debug.WriteLine and logging statements via popular logging frameworks like log4net, NLog, etc.


Image title

ASP.NET Trace View With Prefix


Understanding what your code is doing is essential to validate that your code works. Tools like Prefix help answer that critical question of “what did my code just do?” Prefix gives you instant visibility to what your code is doing, way beyond just basic ASP.NET tracing.


performance ,tracing ,asp.net

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}