直接記錄解決步驟:
程序代碼:
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