使用.Net编写好了WindowsService以后,不安装到系统里就没有任何作用。

[添加Installer]

在服务的设计器画面,属性页面里,选择[Add Installer]链接。

如此便会生成两个新的组件,ServiceProcessInstaller和ServiceInstaller。

ServiceProcessInstaller组件用来保持服务运行时的账户类型和凭证信息(LocalSystem,LocalUser,User等)。

ServiceInstaller组件用来保持注册表(HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services)中服务的关联信息,包括 服务名,显示名称,依赖关系,启动类型--自动,手动等。

 

如果一个工程中有数个服务,则需要分别添加这些服务的ServiceInstaller,并且可以在Install和Uninstall事件中对安装和卸载服务进行额外的处理。

准备完毕后,就可以安装/卸载服务了

InstallUtil Myservice.exe

InstallUtil Myservice.exe /u

 

参考自:http://www.itmedia.co.jp/enterprise/articles/0502/01/news083_4.html

 

相关文章:

  • 2022-01-29
  • 2021-11-19
  • 2021-04-12
  • 2021-09-30
  • 2021-09-27
  • 2021-08-13
  • 2021-10-24
  • 2021-08-16
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-29
  • 2021-10-26
  • 2021-06-07
  • 2022-12-23
  • 2021-08-27
相关资源
相似解决方案