How do you debug web applications written in C# in Visual Studio? I'm using Console.WriteLine expecting the text to appear in the Output tab. Like it does when you develop console applications. But for web applications, the console output doesn't show up anywhere.
To display the Output window whenever you build a project, in the Options dialog box, on the Projects and Solutions > General page, select Show Output window when build starts.
Build and run your code in Visual Studio To run the code, on the menu bar, choose Debug, Start without debugging. A console window opens and then runs your app. When you start a console app in Visual Studio, it runs your code, then prints "Press any key to continue . . ." to give you a chance to see the output.
Debug.WriteLine
They are two form to write in Console Output for NET applications.
Debug.WriteLine() // See [Microsoft Documentation][1]
Trace.WriteLine() // See [Microsoft][2] documentation for more information
The difference between the two is that Debug only work when the program is in DEBUG mode. In the other hand TRACE works always. You can also set different levels of TRACE. See documentation for more information.
I hope that this information help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With