[英]How to grant rights to HTTP namespace on installed service?
I have written a Windows Service, that opens up a WCF service on port 8003 of the local machine. 我编写了一个Windows服务,它在本地计算机的端口8003上打开了一个WCF服务。 Or at least, it's supposed to.
或者至少,它应该是。 The service can't start up, because of the famous exception:
由于着名的例外,该服务无法启动:
System.ServiceModel.AddressAccessDeniedException: HTTP could not register URL http://+:8003/TRConfigurationService/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details).
This problem is addressed here , with a very simple answer: run a command prompt in admin mode, and execute: 这个问题解决在这里 ,有一个非常简单的答案:运行管理模式命令提示符,然后执行:
netsh http add urlacl url=http://+:8003/ user=DOMAIN\UserName
All very well and good, and I can do that manually on my local dev machine. 一切都非常好,我可以在我的本地开发机上手动完成。 But how do I do that on the client installation, without the user having to do anything other than click "Yes" (only once after/during installation) when prompted to run in Admin mode?
但是如何在客户端安装时执行此操作,而不是用户必须执行任何操作而不是在提示在管理模式下运行时单击“是”(仅在安装后/安装期间执行一次)?
Looks like the answer is simply to make sure the service runs in admin mode, then there's no problem! 看起来答案只是为了确保服务在管理模式下运行,那么没有问题! For those who don't know, add an app.manifest file to the project, and set
对于那些不知道的人,将app.manifest文件添加到项目中,然后进行设置
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.