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

一次安装两个服务

 

posted @ 2017-06-29 13:49  白色的回忆  阅读(1404)  评论(0编辑  收藏  举报