AddressAccessDeniedException:不使用netsh解决它?
【腾讯云】亏本大甩卖,服务器4核16G 1年370元(带宽12M,系统盘120GB SSD盘,月流量2000GB)!!!!!!
云产品 配置 价格
服务器 1核2G,带宽5M,系统盘50GB SSD盘,月流量500GB 38元/年
MySQL 1核1G 19元/年
服务器 16核32G,带宽18M,系统盘250GB SSD盘,月流量5000GB 1197元/年
点我进入腾讯云,查看更多详情

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 saw the command :

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

#0

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

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

推荐文章

由nginx出现504 Gateway Time-out发现sql运行太慢

由nginx出现504 Gateway Time-out发现sql运行太慢

推荐文章

是否有方法对所有oracle包和过程进行全文搜索?

是否有方法对所有oracle包和过程进行全文搜索?

推荐文章

Spring MVC-自定义数据类型转换解决方案

Spring MVC-自定义数据类型转换解决方案

推荐文章

如何使用Emacs将当前日期和时间插入到文件中?

如何使用Emacs将当前日期和时间插入到文件中?

推荐文章

DSOFramer在另一个窗口中关闭Excel文档。如果文件中有未保存的数据,dsoframer将无法打开,并显示“试图访问无效地址”

DSOFramer在另一个窗口中关闭Excel文档。如果文件中有未保存的数据,dsoframer将无法打开,并显示“试图访问无效地址”

推荐文章

Ngixn根据手机端与电脑端设备相同地址显示不同页面内容

Ngixn根据手机端与电脑端设备相同地址显示不同页面内容

推荐文章

php中MVC zend framework框架在apache上的配置方法以及创建步骤,配置虚拟主机

php中MVC zend framework框架在apache上的配置方法以及创建步骤,配置虚拟主机

推荐文章

string.split返回一个string[]我想要一个List是否有一行代码将数组转换为List?

string.split返回一个string[]我想要一个List是否有一行代码将数组转换为List?

推荐文章

在编写.NET代码时,有关避免内存泄漏的“注意”列表是什么?

在编写.NET代码时,有关避免内存泄漏的“注意”列表是什么?

推荐文章

新旧站整合nginx配置

新旧站整合nginx配置

推荐文章

mvc教程

mvc教程

推荐文章

如何使用maven从subversion导出项目?

如何使用maven从subversion导出项目?

推荐文章

NGINX日志文件按日分割成单独文件的方法

NGINX日志文件按日分割成单独文件的方法

推荐文章

MVC架构-Struts2框架

MVC架构-Struts2框架

推荐文章

找不到二月十五日

找不到二月十五日

推荐文章

如果找不到图像,则显示某些图像的自定义图像-Lighttpd

如果找不到图像,则显示某些图像的自定义图像-Lighttpd