如何创建将在桌面上运行控制台窗口的Windows服务

问题描述:

如何创建可以在桌面上打开控制台的服务?我之前从未做过任何服务。请指教。

How can I create a service that can keep a console open on the desktop? I have never done any services before. Please advice.

试试如何使用控制台模式编写.NET Windows服务 [ ^ ]。


很明显你需要使用

while(true){...}



while(Console.ReadKey()。KeyChar!='someKeyChar'){...}



-KR
It's a quite obvious that you need to use
while(true) { ... }
or
while (Console.ReadKey().KeyChar !='someKeyChar') { ... }

-KR