System.Console.WriteLine问题 [英] System.Console.WriteLine question

查看:70
本文介绍了System.Console.WriteLine问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨新闻组,


我正在使用C#(VS.NET 2003)编写Web窗体程序并试图在运行时监视它
使用System.Console.WriteLine(< params>)但是

不能为我的生活找到它输出的地方。


我是厚的还是不幸的?

请帮忙!


Lost&困惑,英国


Ps:回到过去,我们有一种名为TRACE的东西。 ;-)

解决方案

不幸的是我认为你不能使用Console。显然标准输入

和标准输出没有映射到ASP.NET

应用程序的控制台。我建议打开一个文件并写入文件,以便进行

日志记录。我前段时间遇到过这个问题。你不会错过

任何东西。


Thomas P. Skinner [MVP]


" newsgroupie" <是ne ********* @ nospam.com>在消息中写道

新闻:QR ************** @ rjmeltd.demon.co.uk ...

嗨新闻组,

我正在使用C#(VS.NET 2003)编写Web窗体程序,并尝试在使用System.Console.WriteLine(< params>)运行时监视它"但是我不能为我的生活找到输出的地方。

我是厚人还是不走运?

请帮忙!

迷失&迷茫,英国

Ps:回到过去,我们有一种叫做TRACE的东西。 ; - )



Thomas P. Skinner [MVP]写道:

不幸的是我不认为你可以使用Console 。显然,标准输入
和标准输出未映射到ASP.NET
应用程序的控制台。我建议打开一个文件并写入文件以进行日志记录。我前段时间遇到过这个问题。你不会错过
任何事情。


Ps:回到过去,我们有一种名为TRACE的东西。 ; - )




Couldent您只需使用System.Diagnostics.Debug.WriteLine吗?


< BLOCKQUOTE>是。只要您在VS.NET下调试

模式下运行应用程序,这就可以正常工作。 Debug.WriteLine调用的输出转到输出窗口。我认为这个问题更适合于一种记录/监控而不是调试。


我经常改变构建一个Windows窗体应用程序的控制台构建

就是出于这个目的。当你这样做时,你得到一个控制台窗口,你可以使用Console.WriteLine输出到。无论你是否从VS.NET运行程序,这都有效。


Thomas P. Skinner [MVP]

" Benjamin" < CS ************ @ spamgourmet.com>在消息中写道

news:u2 ************** @ tk2msftngp13.phx.gbl ...

Thomas P. Skinner [ MVP]写道:

不幸的是我不认为你可以使用Console。显然,标准的
输入和标准输出未映射到ASP.NET
应用程序的控制台。我建议打开一个文件并写入文件以进行日志记录。我前段时间遇到过这个问题。你没有遗漏任何东西。


Ps:回到过去,我们有一种名为TRACE的东西。 ; - )



你只需要使用System.Diagnostics.Debug.WriteLine吗?



Hi Newsgroupies,

I''m writing a Web Forms program using C# (VS.NET 2003) and trying to
monitor it whilst running using "System.Console.WriteLine(<params>)" but
can''t for the life of me find where it outputs too.

Am I thick or just unlucky?

Please help!

Lost & Bewildered, UK

Ps: Back in the good old days we had something called "TRACE" ;-)

解决方案

Unfortunately I don''t think you can use Console. Apparently standard input
and standard output are not mapped to the console for an ASP.NET
application. I would suggest opening a file and writing to the file for
logging purposes. I ran into this issue some time ago. You are not missing
anything.

Thomas P. Skinner [MVP]

"newsgroupie" <ne*********@nospam.com> wrote in message
news:QR**************@rjmeltd.demon.co.uk...

Hi Newsgroupies,

I''m writing a Web Forms program using C# (VS.NET 2003) and trying to
monitor it whilst running using "System.Console.WriteLine(<params>)" but
can''t for the life of me find where it outputs too.

Am I thick or just unlucky?

Please help!

Lost & Bewildered, UK

Ps: Back in the good old days we had something called "TRACE" ;-)



Thomas P. Skinner [MVP] wrote:

Unfortunately I don''t think you can use Console. Apparently standard input
and standard output are not mapped to the console for an ASP.NET
application. I would suggest opening a file and writing to the file for
logging purposes. I ran into this issue some time ago. You are not missing
anything.


Ps: Back in the good old days we had something called "TRACE" ;-)



Couldent you just use System.Diagnostics.Debug.WriteLine for this?


Yes. This works as long as you run the application under VS.NET under debug
mode. The output from Debug.WriteLine calls goes to the output window. I was
thinking the question was geared more to a type of logging/monitoring rather
than debugging.

I often change the build to a console build for a Windows Forms application
for just such a purpose. When you do that you get a console window that you
can use Console.WriteLine to output to. This works regardless of whether you
run the program from VS.NET or not.

Thomas P. Skinner [MVP]

"Benjamin" <cs************@spamgourmet.com> wrote in message
news:u2**************@tk2msftngp13.phx.gbl...

Thomas P. Skinner [MVP] wrote:

Unfortunately I don''t think you can use Console. Apparently standard
input and standard output are not mapped to the console for an ASP.NET
application. I would suggest opening a file and writing to the file for
logging purposes. I ran into this issue some time ago. You are not
missing anything.


Ps: Back in the good old days we had something called "TRACE" ;-)



Couldent you just use System.Diagnostics.Debug.WriteLine for this?



这篇关于System.Console.WriteLine问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆