简体   繁体   English

如何在已安装的服务上授予HTTP命名空间的权限?

[英]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? 但是如何在客户端安装时执行此操作,而不是用户必须执行任何操作而不是在提示在管理模式下运行时单击“是”(仅在安装后/安装期间执行一次)?

听起来你应该能够使用WIX做到这一点

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.

相关问题 如何在64位环境中检查/授予作为服务权限的登录 - How do I check/grant logon as service rights in a 64bit environment WCF服务访问权限:对此名称空间无访问权限 - WCF Service Access right: No access rights to this namespace 以编程方式授予本地用户权限以使用.Net启动服务 - Programmatically grant local user rights to start a service with .Net 如何以编程方式将“作为服务登录”授予虚拟帐户 - How to programatically grant “Log on as a service” to a virtual account 如何授予我的 Windows 服务管理员权限 - How do I give my windows service admin rights 如何更新已安装的 Windows 服务? - How to update an installed Windows service? 如何在Visual Studio 2022中创建C#应用程序安装程序,无需管理员权限即可安装? - How to create C# application installer in Visual Studio 2022, which can be installed without administrator rights? 如何在 angular http 请求中实现 client_credentials 授权类型? - How to implement a client_credentials grant type in an angular http request? C#。 如何以编程方式授予用户登录即服务 - C#. How to programmatically grant User Log On as a Service 已安装NuGet软件包不在命名空间中? - Installed NuGet package not in namespace?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM