Grz*_*nio 13 .net c# msbuild windows-services
在远程计算机上安装用C#编写的Windows服务(以标准方式)的最佳方法是什么,我需要提供应该运行的用户名和密码?
我将从MSBuild运行它作为集成测试的一部分.
编辑:我没有msi,我不想创建一个.
Pat*_*ald 26
您可以使用SC命令.
sc.exe \\remotecomputer create newservice binpath= C:\Windows\System32\Newserv.exe start= auto obj= DOMAIN\username password= pwd
(注意等号后的空格很重要)
Creates a service entry in the registry and Service Database.
SYNTAX:
sc create [service name] [binPath= ] <option1> <option2>...
CREATE OPTIONS:
NOTE: The option name includes the equal sign.
type= <own|share|interact|kernel|filesys|rec>
(default = own)
start= <boot|system|auto|demand|disabled>
(default = demand)
error= <normal|severe|critical|ignore>
(default = normal)
binPath= <BinaryPathName>
group= <LoadOrderGroup>
tag= <yes|no>
depend= <Dependencies(separated by / (forward slash))>
obj= <AccountName|ObjectName>
(default = LocalSystem)
DisplayName= <display name>
password= <password>
Run Code Online (Sandbox Code Playgroud)