System.ServiceProcess
OnStart/OnStop/OnPause/OnContinue/OnShutdown/OnPowerEvent/OnCustomCommand。ServiceName:服務唯一名稱。AutoLog:自動記錄狀態變更至事件檢視器。CanStop/CanPauseAndContinue/CanShutdown/CanHandlePowerEvent:啟用對應虛擬方法。ProjectInstaller (含 ServiceProcessInstaller + ServiceInstaller)。ServiceProcessInstaller.Account、ServiceInstaller.StartType (Automatic/Manual/Disabled)。InstallUtil.exe MyService.exe。InstallUtil.exe /u MyService.exe。ServiceController 類別:Start()/Stop()/Pause()/Continue()、屬性 Status、ServiceName。
Windows 服務以 ServiceBase 封裝邏輯,Installer 標準化部署,ServiceController 提供管理介面,是長期運行背景任務的標準解決方案。