使用 InstallUtil.exe 安装时将窗口服务设置为以当前用户身份运行

发布于 2024-09-29 13:20:36 字数 247 浏览 0 评论 0原文

有没有办法安装 Windows 服务并自动将其设置为以当前用户身份运行,而无需每次安装时手动填写详细信息?

我们正在开发一个 Windows 服务,并希望在开发人员计算机上自动安装该服务,以便每个人都可以快速启动并运行该项目。我们使用 InstallUtil.exe 进行安装。

由于需要访问的资源,我们的服务无法作为本地服务、本地系统或网络服务运行。我们知道可以传递用户名和密码,但希望避免设置域用户,这样如果有更好的选择,我们就可以自动化安装。

Is there a way to install a windows service and automatically set it up to run as the current user without having to manually fill in details each time it installs?

We're developing a windows service and want to automate the installation of the service on developer machines so everyone can get up and running on the project very quickly. We're using InstallUtil.exe to do the install.

Our service can't run as local service, local system or network service because of the resources it needs access to. We know that it's possible to pass in a username and password but would like to avoid setting up a domain user just so we can automate the install if there's a better option.

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

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

发布评论

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

评论(1

誰ツ都不明白 2024-10-06 13:20:36

不,那是不可能的。如果服务以用户身份运行,则服务控制管理器必须缓存用户 ID 和密码。在安装过程中,它无法访问当前用户的密码,因此安装例程必须以某种方式提供该密码。

您的服务可能可以作为网络服务运行,您只需授予所有开发人员计算机帐户访问所需资源的权限即可。

No that is not possible. If the service is running as a user, the service control manager has to cache the user id and password. During setup, it does not have access to the current user's password, so the install routine will have to supply that in some way.

Your service probably could run as network service, you just have to give all the developers machine accounts access to the needed resources.

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