以用户身份安装Windows服务失败 [英] Installing a windows service as a user fails

查看:176
本文介绍了以用户身份安装Windows服务失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用.Net Framework 3.5版开发Windows服务.它需要在远程计算机上调用Web服务,而我遇到了一个奇怪的安装问题.

I'm developing a windows service using .Net framework version 3.5. It needs to call a web service on a remote machine and I'm running into a weird installation problem.

我以前以User(默认值)的形式将其安装在计算机上,并在出现提示时提供了我的登录名和密码,并且一切正常.然后在某个时候,它停止工作了,我发现将它安装为LocalSystem并可以正常工作.

I used to install it on my machine as User (the default), and when prompted provided my login and password and everything worked fine. Then at some point, it stopped working, and I found out about installing it as LocalSystem and that worked fine.

现在,我正在尝试调用远程Web服务,并且从WCF中收到错误消息:

Now I'm trying to call the remote web service and I'm getting an error from WCF:

There was no endpoint listening at https://www.remote.com/webservice.asmx that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

显然,这可能是由于该服务以LocalSystem身份运行(没有Internet访问):

Apparently, this could be due to running the service as LocalSystem (which doesn't have internet access) : There was no endpoint listening at <URI> that could accept the message. This is often caused by an incorrect address or SOAP action

因此,我试图切换回以User身份安装服务并提供我的凭据(此时我应该注意,我是计算机的管理员).但这不起作用,并且错误消息(以及InstallUtil日志文件的内容)几乎无用:

So, I've tried to switch back to installing the service as User and providing my credentials (I should note at this point that I'm an administrator of my machine). But it doesn't work, and the error message (and the contents of the InstallUtil log file) are next to useless:

Running a transacted installation.

Beginning the Install phase of the installation.
See the contents of the log file for the Service.exe assembly's progress.
The file is located at Service.InstallLog.

An exception occurred during the Install phase.
System.InvalidOperationException: An exception occurred in the OnAfterInstall event handler of System.ServiceProcess.ServiceInstaller.
The inner exception System.InvalidOperationException was thrown with the following error message: Service ServiceName was not found on computer '.'.
The inner exception System.ComponentModel.Win32Exception was thrown with the following error message: The specified service does not exist as an installed service.

The Rollback phase of the installation is beginning.
See the contents of the log file for the Service.exe assembly's progress.
The file is located at Service.InstallLog.

The Rollback phase completed successfully.

The transacted install has completed.

据我所知,相关的内容是该服务无法安装.没有更多信息!为什么服务可以以LocalSystem的身份成功安装但以User的身份(管理员组的成员)安装却失败的任何想法?

As far as I can tell the relevant bit is that the service failed to install. No more information! Any ideas why a service might install successfully as LocalSystem but fail when installing as User who is a member of the Administrators group?

推荐答案

尝试

Try the NetworkService user. LocalService is not allowed to have connections to the outside world for security reasons.

由于您无法自己安装该服务,可能是由于UAC所致.我发现,即使您是帐户管理员,除非完全关闭UAC,否则无法安装服务.这是因为您的帐户没有此特殊特权.我相信您可以通过组策略管理器来解决此问题.

As for the reason you can't install the service as yourself, this might be due to UAC. I have found that installing services is impossible unless UAC is completely turned off, even if you are Administrator of your account. This is because your account does not have this special privilege. I believe you can fix this through the Group Policy Manager.

这篇关于以用户身份安装Windows服务失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆