簡體   English   中英

如何記錄消息以便可以在VS2013中看到它?

[英]How can I log a message so that I can see it in VS2013?

我正在本地運行VS2013 Azure應用程序,並向Debug窗口輸出一條消息,如下所示:

Debug.WriteLine(logString);

這有時會起作用,有時我會收到一條消息,說:

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

從我從SO上的其他答案中了解到,當我使用Debug.Write()時,與診斷程序存在某種沖突。

那么,有沒有其他方法可以在我測試時將消息寫入輸出窗口呢? 我知道有一個Console.Write,但是由於我沒有控制台,因此無法正常工作。

使用System.Diagnostics,可以使用跟蹤對象:

Trace.Write("YOUR MESSGE");

這是參考...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM