使用 MSBuild 和 Microsoft.Sdc.Tasks 安装 win32 服务

发布于 07-11 15:16 字数 362 浏览 6 评论 0 原文

我正在尝试使用 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

挽你眉间 2024-07-18 15:16:37

找到这篇文章并且由于我的服务所做的只是从本地文件中写入和读取,因此我应该可以在本地服务帐户而不是特定用户下运行。 即使更新了服务安装程序后,ControlService 目标也需要用户名和密码才能运行,但实际上并没有提示我输入用户名和密码。 但随后我不想运行特定用户,并且当配置中未提供用户和密码时目标会失败......奇怪。

我通过使用 InstallUtil.exe 来解决。 将“我设置服务安装程序”设置为作为本地服务帐户运行后,效果很好。

<Exec WorkingDirectory="C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727"
            Command="InstallUtil.exe -i XXX.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.

<Exec WorkingDirectory="C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727"
            Command="InstallUtil.exe -i XXX.exe" />
独孤求败 2024-07-18 15:16:37

仅供参考,要安装到远程服务器,您应该使用此处列出的 SericeController 任务:

http://weblogs.asp.net/scottgu/archive/2006/02/12/438061.aspx

Just an FYI, to install to a remote server, you should use the SericeController task listed here:

http://weblogs.asp.net/scottgu/archive/2006/02/12/438061.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文