Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trace messages not appearing in trace.axd

Tags:

c#

asp.net

trace

I'm trying to write messages to the trace.axd file from a wcf service, however my trace messages are not ariving at all.

The code that I use to write the messages is:

System.Diagnostics.Trace.Write("Value updated to: " + value.ToString());

In the web config file I have tracing enabled:

<trace enabled="true" requestLimit="15" pageOutput="false" localOnly="false"/>

However when I look at the trace.axd file, my messages are not available. I've even stepped through the code and I know its hitting the Trace.Write value.

The only thing that I can think of that is causing this is because the method has IgnoreDataMember above it.

Does anyone have any idea?

like image 333
Lex Avatar asked Sep 04 '25 02:09

Lex


1 Answers

When I see attribute pageOutput it clearly means that you are trying to configure ASP .NET Trace which only works for Web Applications. The Trace.axd is a web page generated by ASP .NET Trace.

The .NET framework itself has .NET Trace which works for all kinds of applications or projects (Web or Windows Applications, or your Class Library projects). System.Diagnostics.Trace.Write is a function defined by .NET Trace. By default, .NET Trace output is the output window inside Visual Studio. If you want to forward this output to the Trace.axd page, you need the configuration entry as suggested by Mathew Paxinos in his answer below:

<system.diagnostics>
    <trace>
        <listeners>
            <add name="WebPageTraceListener"
                 type="System.Web.WebPageTraceListener, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
        </listeners>
    </trace>
</system.diagnostics>

Source MSDN Article (verified on September 23rd, 2019)

like image 92
user3918598 Avatar answered Sep 06 '25 14:09

user3918598