Error in installing Windows service developed in .Net

拈花ヽ惹草 提交于 2019-12-03 04:02:21

问题


I have developed a windows service using C#,visual studio 2008. I have windows xp sp2 installed on my machine. When I try to install the service using installutil tool, after entering the username and password, I get following error.

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 is installutil /i TestService.exe

I am unable to resolve the issue.

Thanks in Advance

Sambha


回答1:


If the account is a local user account, try to use .\username when installutil prompts for the username and password.

The .\ stands for local machine.

Services require a fully qualified username (with domain), so when installing you need to be explicit about local user accounts.




回答2:


The account may also need to be given the "Log on as a service" account right; pass the SE_SERVICE_LOGON_NAME constant to the LsaAddAccountRights() API.




回答3:


I solved this by changing ServiceProcessInstaller.Account to LocalSystem. and its works for me.



来源:https://stackoverflow.com/questions/2205744/error-in-installing-windows-service-developed-in-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!