直接记录解决步骤:
程序代码:
HttpListener httpListener = new HttpListener();
httpListener.Prefixes.Add("http://+:7070/");
httpListener.Start();
1.先删除可能存在的错误urlacl:
netsh http delete urlacl url=http://+:7070/
2.重新添加,user选择所有人:
netsh http add urlacl url=http://+:7070/ user=Everyone
3.配置防火墙(或者直接关闭):
netsh advfirewall firewall Add rule name=\"命令行Web访问8080\" dir=in protocol=tcp localport=7070 action=allow