使用C#代码安装、卸载、启动、停止Service

时间:2016-09-27 15:58:00
【文件属性】:
文件名称:使用C#代码安装、卸载、启动、停止Service
文件大小:421KB
文件格式:RAR
更新时间:2016-09-27 15:58:00
Service 服务 安装 Installer 在需要安装的项目文件中添加WindowsService项目的引用,在程序集中获取Service.exe的路径,使用 AssemblyInstaller类对service进行安装。在安装时,使用ServiceController判定服务是否存在,如果已存在该service,则先卸载,再重新安装。在卸载时,使用ServiceController判断Service是否在运行,如果在运行,则先停止该服务,然后再卸载
【文件预览】:
testService
----testService.sln(2KB)
----testService()
--------bin()
--------App.xaml(322B)
--------obj()
--------App.xaml.cs(307B)
--------Installer1.cs(2KB)
--------Class1.cs(8KB)
--------Installer1.resx(6KB)
--------testService.csproj(5KB)
--------jumplist_useronline.ico(1KB)
--------Installer1.Designer.cs(1KB)
--------MainWindow.xaml(611B)
--------Properties()
--------MainWindow.xaml.cs(2KB)
----testService.suo(40KB)
----Setup1()
--------Release()
--------Setup1.vdproj(34KB)
--------Debug()
----WindowsService1()
--------bin()
--------Service1.resx(6KB)
--------Program.cs(510B)
--------obj()
--------Service1.cs(1KB)
--------ProjectInstaller.resx(6KB)
--------Class1.cs(8KB)
--------ProjectInstaller.cs(421B)
--------WindowsService1.csproj(3KB)
--------ProjectInstaller.Designer.cs(2KB)
--------Service1.Designer.cs(1KB)
--------Properties()

网友评论

  • 资源不错,很有参考价值
  • 好久没有做过安装包了,好多东西忘记,今天看了一下,做起来还是挺方便的。
  • 代码一般,没有特别大的借鉴价值
  • 好像不兼容win8,试了几次报错。
  • 资源还不错,只是就看了一下源码。