HttpListener.Start() AccessDenied error on Vista

二次信任 提交于 2019-11-28 23:29:35

I do not understand why but here it is. It seems that the cause is that my network card is configured with 2 IPs.

if in the code i specify one of the ips (like i did in question above)

listener.Prefixes.Add("http://myip1:8080/app/");

then to avoid exception i need to register it with IP-bound weak wildcard

netsh http add urlacl url=http://myip1:8080/app user=domain\user

however if i add prefix with the strong wildcard (plus sign)

listener.Prefixes.Add("http://+:8080/app/");

and register with the same wild card

netsh http add urlacl url=http://+:8080/app user=domain\user

then there is no error and i can access my app from both ip.

Is that URI already registered on the system?

http://msdn.microsoft.com/en-us/library/system.net.httplistenerexception.aspx says that would be one cause.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!