本文介绍了安装Windows服务在用户的凭据与ServiceAccount.User运行,但不提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个C#Windows服务,并创建一个安装与之配套的Visual Studio安装项目。它成功地安装服务。

I have created a C# Windows Service and its accompanying Visual Studio Setup project that creates an installer. It successfully installs the service.

当我选择枚举的任意值 ServiceAccount 除了 ServiceAccount.User ,该服务不使用提示安装适当内置的用户。我所后,实际上是在当前用户的凭据安装服务。当我指定 ServiceAccount.User ,我得到了安装过程中的用户名和密码的提示。我需要做的是找到一种方法来安装的用户是谁运行安装,而不提示输入密码,凭证的服务。

When I choose any value from enum ServiceAccount apart from ServiceAccount.User, the service installs without prompting using the appropriate built-in user. What I am after is actually installing the service under current user's credentials. When I specify ServiceAccount.User, I get a prompt for a user name and password during installation. What I need to do is find a way to install the service with the credentials of the user who is running the setup without prompting for password.

这是在所有可能的?我愿意求助于需要(如P / Invoke的负荷)的任何措施,把工作做好。

Is this at all possible? I am willing to resort to any measures needed (like loads of P/Invoke) to get the job done.

推荐答案

您不能,有没有办法提取明文密码,除非一些配置错误,你就需要一个建立服务。请参见这类似的问题

You can't, there's no way to extract the clear-text password unless something is misconfigured and you'll need that to set up the service. See this similar question.

另外,在一般情况下,服务应该与每个服务一个单独的和独特的帐户与最少的特权安装

Also, in general, services should be installed with a separate and unique account per service with least privilege.

这篇关于安装Windows服务在用户的凭据与ServiceAccount.User运行,但不提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 17:19