AddressAccessDeniedException:在没有netsh的情况下解决它? [英] AddressAccessDeniedException : resolve it without netsh?

查看:159
本文介绍了AddressAccessDeniedException:在没有netsh的情况下解决它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了异常 AddressAccessDeniedException ,因为我的processus无权注册该URL。我首先以管理员身份运行我的程序:好吧,它运行了。

I encountered the exception AddressAccessDeniedException because my processus does not have the right to register the URL. I first ran my program as an administrator : ok, it worked.

但我现在想要分发我的应用程序,我希望每个用户都能够运行它无需成为管理员。

But I now want to distribute my application, and I would like every user to be able to run it without having to be administrator.

有没有办法自动授予用户访问权限?

Is there a way to automatically grant the access to the user?

I看到命令:

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

我应该使用它吗?如果是的话,怎么样?

Should I use that? If yes, how?

我想做的就是授予访问权限而不是管理员......这样说,看起来很愚蠢,但可能是...

What I would like to do would be to grant the access withouth being an administrator... said like that, it seems stupid, but may be...

推荐答案

这是不可能的。 Windows使用内核驱动程序处理HTTP请求,并且在此驱动程序上打开侦听器由ACL(访问控制列表)保护。如果要打开侦听器以便应用程序可以侦听来自其他计算机的请求,则必须以管理员身份运行它以通过ACL,或者您必须具有权限(=您必须在ACL中)。您也可以关闭UAC(用户访问控制)以绕过这些检查。

That is not possible. Windows uses kernel driver to process HTTP requests and opening listeners on this driver is secured by ACLs (access control list). If you want to open listener so that your application can listen on requests from other machines you must either run it as administrator to pass ACL or you must have permissions (= you must be in ACL). You can also turn off UAC (user access control) to bypass these checks.

netsh 是一个允许你的工具为HTTP.sys(内核驱动程序)设置ACL。您可以授予任何用户监听所选端口的权限,但显然您必须是管理员才能授予这些权限,或者您必须具有委派已配置权限的权限,否则此安全性的全部内容将消失。

netsh is a tool allowing you to set up ACL for HTTP.sys (kernel driver). You can give permissions to any user to listen on selected port but obviously you must be admin to give these permissions or you must have permissions to delegate rights for already configured permissions otherwise the whole point of this security will be gone.

netsh 添加到您的安装包中,并要求以管理员身份完成安装(这对于许多应用程序来说非常常见)。另请注意,netsh仅适用于Windows Vista,Windows 7,Windows Server 2008和Windows Server 2008 R2。对于Windows 2003和Windows XP(至少需要SP2),您需要另一个名为 httpcfg 的工具,它不是操作系统安装的一部分(必须单独安装)。

Add that netsh call to your installation package and require the installation to be done as admin (that is quite common for many applications). Also be aware that netsh works only on Windows Vista, Windows 7, Windows Server 2008 and Windows Server 2008 R2. For Windows 2003 and Windows XP (at least SP2 is required) you need another tool called httpcfg which is not part of OS installation (it must be installed separately).

这篇关于AddressAccessDeniedException:在没有netsh的情况下解决它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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