How can I see console output from WCF service during debugging?

How can I see the SQL query generated from LINQ to SQL when debugging inside a WCF service? I thought I could just set dataContext.Log = Console.Out and SQL would be written to the output / immediate window. Is this not because I am hosting using IIS? Console.WriteLine("Hello") does not even write anything to the output / immediate access window.

How do you see the output of my console?

+4
source share
2 answers

Instead, you can write it to a file. dataContext.Log accepts any TextWriter.

See this comment for a good way to get a text message writing in Debug.

+2
source

You can try using System.Diagnostics.Debug.WriteLine() , so when you distribute the Release application, these lines will be removed from the code.

+5
source

All Articles