WIX ServiceInstall - 将服务设置为在 NetworkService 帐户下运行

发布于 2024-08-09 09:01:03 字数 365 浏览 4 评论 0原文

我正在尝试创建一个 WIX 安装程序来安装 Windows 服务以在 NetworkService 帐户下运行,但在安装过程中出现权限不足错误。

我发现这篇文章中有人似乎遇到了同样的问题,但没有提供真正的解决方案:

http://n2.nabble.com/Re-WiX-users-Digest-Vol-40-Issue-129-td3782055.html

我确信有人之前一定已经实现了这一点,并且想知道他们是否愿意分享一个代码片段?

I am trying to create a WIX installer to install my windows service to run under the NetworkService account and getting an Insufficient Priviledges error during the installation.

I found this post where someone seems to be experiencing the same problem but no real solution was offered:

http://n2.nabble.com/Re-WiX-users-Digest-Vol-40-Issue-129-td3782055.html

I'm sure someone must have acheived this previously and wondered if they'd be kind enough to share a code snippet?

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

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

发布评论

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

评论(4

悲喜皆因你 2024-08-16 09:01:03

注意:下面的答案仅与提出问题时的较旧版本的 WIX 和 Windows 相关。如果您设置本机“NT AUTHORITY”,则当前版本的 WIX 服务凭据将起作用。域和“NetworkService”帐户(现在不需要空间)。


原始答案:

正确的身份名称是“NT Authority\Network Service”而不是“NT Authority\NetworkService”。需要一个空间才能工作。

有趣的是,默认的“LocalSystem”直接与 WIX 3.5 一起使用,但对于其他知名帐户,您必须以“NT Authority...”为前缀,例如“LocalService”在直接使用时也不起作用。

即修复此问题:

Account='NT Authority\Network Service'

NOTE: The answer below is only relevant on the older builds of WIX and Windows at the time the question was raised. The current version of the WIX service credentials will work if you set the native "NT AUTHORITY" domain and "NetworkService" account (no space necessary now).


Original Answer:

The correct identity name is "NT Authority\Network Service" not "NT Authority\NetworkService". A space is required then it works.

Funny that the default "LocalSystem" works directly with WIX 3.5, but for other well known accounts you have to prefix with "NT Authority...", for example "LocalService" does not work either when used directly.

i.e. fix this with:

Account='NT Authority\Network Service'

丶情人眼里出诗心の 2024-08-16 09:01:03

似乎之前安装失败的一些残留物阻止我使用 Account="NT Authority\NetworkService" 删除并重新安装。宇宙再次一切安好。

It seems a few remnants of a previously failed install were preventing me from removing and reinstalling with Account="NT Authority\NetworkService". All is well in the universe again.

弃爱 2024-08-16 09:01:03

我在 Windows 8.1 FR 和 Windows 2012R2 ENU 下运行了以下代码片段。但使用 NT AUTHORITY\NETWORK SERVICE 失败,并出现权限不足错误。

因此,至少在最近的系统中,您必须使用 NT AUTHORITY\NETWORKSERVICE,如 MSDN

              <ServiceInstall Id="xserviceInstall" Name="$(var.xServiceid)" 
              DisplayName="$(var.xServiceid)" 
              Description="x service" Start="auto" Type="ownProcess"
              ErrorControl="ignore" 
              Account="NT AUTHORITY\NETWORKSERVICE" 
              Arguments="-w -N" Vital="yes" />

I had the following snippet working under Windows 8.1 FR, and Windows 2012R2 ENU. But using NT AUTHORITY\NETWORK SERVICE failed with the insufficied privileges error.

So, at least under recent systems you must use NT AUTHORITY\NETWORKSERVICE as documented in MSDN.

              <ServiceInstall Id="xserviceInstall" Name="$(var.xServiceid)" 
              DisplayName="$(var.xServiceid)" 
              Description="x service" Start="auto" Type="ownProcess"
              ErrorControl="ignore" 
              Account="NT AUTHORITY\NETWORKSERVICE" 
              Arguments="-w -N" Vital="yes" />
意中人 2024-08-16 09:01:03

我使用 customAction 来查找用户凭据是否正确。

如果用户凭据与他们想要安装的计算机中的帐户匹配,我将允许他们继续进入下一个对话框(UI),否则我将显示另一个对话框,指示用户未找到该帐户。

I used customAction to find the user credentials are correct or not.

If user credentials are matches the account in the machine they want to install,I will allow them to proceed to next dialog(UI) other wise I will show another Dialog indicating the user that account not found.

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