2

I am running a VS2013 Azure application locally and outputing a message to the Debug window like this:

Debug.WriteLine(logString);

This works SOMETIMES and other times I get a message saying:

Not running in a hosted service or the Development Fabric.
Could not create Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener,     Microsoft.WindowsAzure.Diagnostics, 

From what I understand from other answers on SO there is some kind of conflict with the Diagnostics when I use Debug.Write().

So is there another way I can write a message to the output window just while I am testing? I know there is a Console.Write but this will not work as I do not have a console.

  • Make sure you set the cloud service project as startup project, not any role project as startup OR refer to this related SO [answer](http://stackoverflow.com/a/13881495/122005). – chridam Mar 27 '14 at 13:59

1 Answers1

0

Using System.Diagnostics, you can use the trace object:

Trace.Write("YOUR MESSGE");

Here's a reference...

Karim AG
  • 2,166
  • 15
  • 29