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

发布于 2024-10-09 22:33:02 字数 726 浏览 0 评论 0原文

我编写了一个 Windows 服务,它在本地计算机的端口 8003 上打开 WCF 服务。或者至少,应该是这样。由于著名的异常,该服务无法启动:

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).

此问题已解决 这里,有一个非常简单的答案:在管理模式下运行命令提示符,然后执行:

netsh http add urlacl url=http://+:8003/ user=DOMAIN\UserName

一切都很好,我可以在本地开发人员上手动执行此操作机器。但是,如何在客户端安装中执行此操作,而无需用户在提示以管理员模式运行时单击“是”(仅在安装后/安装过程中一次)之外执行任何操作?

I have written a Windows Service, that opens up a WCF service on port 8003 of the local machine. 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

撞了怀 2024-10-16 22:33:02

听起来你应该能够使用WIX< /a>.

It sounds like you should be able to do it using WIX.

鱼窥荷 2024-10-16 22:33:02

看起来答案只是确保服务在管理模式下运行,那就没有问题了!对于那些不知道的人,请在项目中添加一个app.manifest文件,并设置

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

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

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文