安装.NET开发的Windows服务时出错 [英] Error in installing Windows service developed in .NET
问题描述
我使用 C# 和 Visual Studio 2008 开发了一个 Windows 服务.我的机器上安装了 Windows XP SP2.当我尝试使用 installutil 工具安装服务时,输入用户名和密码后,出现以下错误.
I have developed a windows service using C# and Visual Studio 2008. I have Windows XP SP2 installed on my machine. When I try to install the service using the installutil tool, after entering the username and password, I get the following error.
在安装阶段发生异常.System.ComponentModel.Win32Exception: 帐户名无效或不存在,或者指定帐户名的密码无效.
An exception occurred during the Install phase. System.ComponentModel.Win32Exception: The account name is invalid or does not exist, or the password is invalid for the account name specified.
但用户确实存在.我通过控制面板创建了用户 →用户帐户 →创建新帐户.
But the user does exist. I had created the user through control panel → User accounts → Create new account.
我用来安装服务的命令是:
The command I used for installing the service was:
installutil /i TestService.exe
我该如何解决这个问题?
How can I resolve the issue?
推荐答案
如果帐户是本地用户帐户,当 installutil 提示输入用户名和密码时,尝试使用 .\username
.
If the account is a local user account, try to use .\username
when installutil prompts for the username and password.
.\
代表本地机器.
服务需要完全限定的用户名(带域),因此在安装时您需要明确本地用户帐户.
Services require a fully qualified username (with domain), so when installing you need to be explicit about local user accounts.
这篇关于安装.NET开发的Windows服务时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!