Windows 服务(即,以前的 NT 服务)使您能够创建在它们自己的 Windows 会话中可长时间运行的可执行应用程序.这些服务可以在计算机启动时自动启动,可以暂停和重新启动而且不显示任何用户界面.这种服务非常适合在服务器上使用,或任何时候,为了不影响在同一台计算机上工作的其他用户,需要长时间运行功能时使用.还可以在不同于登录用户的特定用户帐户或默认计算机帐户的安全上下文中运行服务. 一.使用C#创建Windows service步骤: 1.文件->新建->项目:选择Windows服务,修…
1.创建windows服务应用 2.右键查看代码 3.写个计时器Timer using System.Timers; 如上图,按tab键快速操作 会自动创建一个委托 改为下边的方式,打印日志来记录服务运行 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.IO; using…