要安裝windows service 首先要找到 InstallUtil.exe,InstallUtil.exe位置在 C:\Windows\Microsoft.NET\Framework\v4.0.30319,用什么版本寫的服務,找到對應版本,各個版本不同詳見(C:\Windows\Microsoft.NET\Framework\版本)
然后使用命令
安裝服務
InstallUtil.exe 服務路徑/windowsServiceName.exe
快捷安裝:直接找到對應的 installutil.exe,拖cmd中,再拖你服務的位置路徑下的服務名稱.exe,(win10 以上系統支持)
啟動該服務
net start windowsServiceName
停止服務
net stop windowsServiceName
卸載服務
InstallUtil.exe /u 服務路徑/windowsServiceName.exe