c# HttpListener拒絕訪問


直接記錄解決步驟:

       程序代碼:

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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM