Windows服務的安裝、卸載
創建一個Windows服務
http://jingyan.baidu.com/article/fa4125acb71a8628ac709226.html
安裝服務
使用FramWork框架自帶的InstallUtil.exe工具安裝服務
一般使用命令行安裝服務,快捷速度
InstallUtil位置:C:\Windows\Microsoft.NET\Framework\
不同版本所在目錄不同,framework2.0在v2.0.50727目錄下
方式一:
以管理員身份運行cmd輸入
C:\Windows\Microsoft.NET\Framework\v4.0.30319.InstallUtil.exe E:\TestApp\Winform\WinServiceTest\WinServiceTest\bin\Debug\WinServiceTest.exe 回車即可安裝服務
方式二:
Dat文件:
%~dp0InstallUtil.exe %~dp0WindowsServiceForWCFDemo.exe
pause
命令行學習:cd 進入目錄 cd..退出目錄 pause 暫停 %~dp0當前目錄 start開始
Windows腳本bat文件
卸載
方式一:
Dat文件刪除:
%~dp0InstallUtil.exe /uninstall %~dp0WindowsServiceForWCFDemo.exe
pause
方式二:
以管理員身份運行cmd,輸入sc delete 服務名
服務在資源管理器的服務名是ServiceName 描述是DisplayName
在服務裏是服務名是DisplayName 描述是DescribeName
開啟服務:net start xxt_service
關閉服務:net stop xxt_service
在設計視圖點擊右鍵,選擇“添加安裝程序”,新增serviceProcessInstaller1和serviceInstaller1兩個組件。
serviceProcessInstaller1屬性設置如下:
Account : localsystem 表示所有用戶均可使用本服務。
serviceInstaller1屬性設置如下:
Description:校訊通模擬話機定時檢測服務 表示將要出現在windows服務管理器中的服務描述。
Displayname:xxt_service 表示將要顯示在windows服務管理器中的服務名稱。
使用
http://www.cnblogs.com/jiewei915/archive/2010/12/14/1905395.html
一次安裝兩個服務
Windows服務的安裝、卸載