2

I've got a WebAPI application (using RC), and I'm trying to write messages to the application trace. I tried following the tutorial here, which has me implementing ITraceWriter, and enabling it in Global.asax.

I did that, and when debugging, it hits breakpoints in my SimpleTracer class, but when I visit Trace.axd, my trace information section is blank. I also tried to write to the trace directly with System.Diagnostics.Trace.WriteLine("Hello, world!"); and it is still blank.

What could I be missing? Does the RC version perhaps not have this functionality?

Ishmael Smyrnow
  • 942
  • 1
  • 9
  • 27
  • There are a series of tips in the answer here, what happens if you run through these? http://stackoverflow.com/questions/13000507/why-does-system-diagnostics-debug-writeline-not-work-in-vs2010-c-sharp – Mark Jones Feb 08 '13 at 09:27
  • Thanks for the link. I checked the applicable hints, but I'm writing to System.Diagnostics.Trace, and I think the problem may be elsewhere. – Ishmael Smyrnow Feb 11 '13 at 14:47

1 Answers1

0

Although not a direct answer to your question have you looked at using the official NuGet package (here) which Enables ASP.NET Web API tracing using System.Diagnostics? This was released as alpha back in Aug 2012 (sometime after the blog you followed to create your example) and is now at RC level.

There are instructions on how to install it here. Which may also assist you with your custom one should you wish to carry on with it.

Mark Jones
  • 12,156
  • 2
  • 50
  • 62
  • Your answer led me to realize that I'm using the RC of Web API. I updated my question. Initial attempts to update to the stable release seemed to cause problems, so I'm not sure if I will take that route just yet. – Ishmael Smyrnow Feb 07 '13 at 17:16