我正在尝试使用 Microsoft.Sdc.Tasks 库安装 Windows 服务。
<ControlService Action="Install"
ServiceName="Service1"
User="XXX
Password="XXX"
ServiceExePath="$(DeployFolder)\XXX.exe"/>
但我不断收到输入用户和密码的提示!这将不起作用,因为我希望将其作为构建服务器上的自动构建。 我的意思是,我想要运行服务的用户和密码位于实际目标中。 如何让它使用配置的用户和密码安装服务而不提示输入?
I'm trying to install windows service using the Microsoft.Sdc.Tasks library.
<ControlService Action="Install"
ServiceName="Service1"
User="XXX
Password="XXX"
ServiceExePath="$(DeployFolder)\XXX.exe"/>
But I keep getting prompted for the user and password! This will not work as I'd like to have it as an automated build on the build server. I mean, the user and password that I want to run the service under are in the actual target. How do I get it to install the service using the configured user and password and not prompt for it?
找到这篇文章并且由于我的服务所做的只是从本地文件中写入和读取,因此我应该可以在本地服务帐户而不是特定用户下运行。 即使更新了服务安装程序后,ControlService 目标也需要用户名和密码才能运行,但实际上并没有提示我输入用户名和密码。 但随后我不想运行特定用户,并且当配置中未提供用户和密码时目标会失败......奇怪。
我通过使用 InstallUtil.exe 来解决。 将“我设置服务安装程序”设置为作为本地服务帐户运行后,效果很好。
Found this post and since all my service does is writing and reading from local file I should be OK running under the Local Service account instead of a specific user. Even after updated the service installer the ControlService-target requires a user and password to run but then I actually doesn't prompt me for the user and password. But then I don't want to run a specific user and the target fails when not provided with a user and password in the config ... Strange.
I solved by shelling out to the InstallUtil.exe instead. That works fine after set the I set service installer to run as a Local Service account.