Windows 服务的安装程序必须 运行 作为 "Network Service"

Installer for Windows service that must run as "Network Service"

使用Visual Studio2015,如何给"Network Service"账号下的运行配置一个Windows服务的InstallShield安装包?我在 Visual Studio 2013 年使用 InstallShield 项目工作,但我似乎无法在这个新版本中使用它。

如果我将 "User Name" 和 "Password" 字段留空(在 Installshield 项目的“3 - 配置目标系统/服务”屏幕上),安装的服务配置为使用 "Local System".

如果我在尝试安装时输入 "Network Service"、"NetworkService"、"NT_AUTHORITY\Network Service"、“.\Network Service”或“.\NetworkService”作为用户名并将密码留空服务,我收到以下错误:

Error 1923. Service [name] could not be 
installed. Verify that you have sufficient 
privileges to install system services."

在我输入此内容时,我无法在他们的 Express Edition 文档中找到与此相关的任何信息:

http://helpnet.flexerasoftware.com/isxhelp21/isxhelp21.htm#StartTopic=helplibrary/FAQFilesNTService.htm

http://helpnet.flexerasoftware.com/isxhelp21/isxhelp21.htm#StartTopic=helplibrary/ServiceSettings.htm

此博客 post 讨论了此新版本中创建服务安装程序的变化:

http://blogs.flexerasoftware.com/installtalk/2014/10/updated-support-creating-an-installation-that-installs-windows-services-.html

我之前的安装程序一定使用了 "old method of using installer classes",因为我的项目确实有一个安装程序 class 将 NetworksService 指定为 运行 的用户。 (讨论这种通常不推荐的方法的文章 link 已损坏。)

据我所知,新的 Express Edition 似乎忽略了我拥有的安装程序 class,而且我还没有找到如何返回到 "is fragile and generally not recommended." 的旧方法

我还没有找到任何关于如何在 Visual Studio 2015 年使用 InstallShield LE(快捷版)实现这一点的信息。

由于我的服务仅部署到单个服务器,因此我的需求并不过分复杂。我已将项目安装程序 class 添加到我的 Windows 服务项目,如 "Adding Installers to the Service" 部分中的此处 https://msdn.microsoft.com/en-us/library/zt39148a(v=vs.110).aspx 所述。这允许您选择 "Network Service" 用户,作为 ServiceProcessInstaller 中的 属性。

如 "Installing the Service" 部分所述,我正在编写安装脚本:

%WINDIR%\Microsoft.NET\Framework64\[framework_version]\installutil.exe MyService.exe

卸载可以通过以下方式完成:

%WINDIR%\Microsoft.NET\Framework64\[framework_version]\installutil.exe /u MyService.exe

这些命令必须 运行 作为管理员,否则你会得到一个错误。

我知道如何使用 InstallShield Premier 来完成。

首先,在属性管理器中定义一个属性:

SGNETSER    NT AUTHORITY\NETWORK SERVICE

然后,在服务中创建一个新服务,并在用户名中准确输入:

[SGNETSER]

这对我有用!