当前位置:首页 > Windows程序 > 正文

一般通过如下命令进行注册Windows服务 @echo off%SystemRoot%\Microsoft.NET\Fr

2024-03-31 Windows程序

开发完Windows处事后,一般通过如下命令进行注册Windows处事

@echo off %SystemRoot%\Microsoft.NET\Framework64\v4.0.30319\installutil.exe %~dp0\处事措施.exe pause

除了脚本的方法,,通过代码,也可以注册Windows处事:

var ti = new TransactedInstaller(); ti.Installers.Add(new ServiceProcessInstaller { Account = ServiceAccount.LocalSystem }); ti.Installers.Add(new ServiceInstaller { DisplayName = displayName, ServiceName = serviceName, Description = description, //运行方法 StartType = ServiceStartMode.Automatic }); ti.Context = new InstallContext(); ti.Context.Parameters["assemblypath"] = 要安置的Windows处事实现dll或exe路径; ti.Install(new Hashtable());

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/33919.html

Jm-杰米博客Jamie
草根站长的技术交流乐园!IT不会不要紧快来好好学习吧!
  • 20786文章总数
  • 7494587访问次数
  • 建站天数
  • 友情链接