HttpClient: Only one usage of each socket address (protocol/network address/port) is normally permitted

前端 未结 4 659
死守一世寂寞
死守一世寂寞 2021-01-04 09:06
using (var client = new HttpClient())
{
 client.BaseAddress = new Uri(Url);
 client.DefaultRequestHeaders.Accept.Clear();
 client.DefaultRequestHeaders.Accept.Add(ne         


        
4条回答
  •  青春惊慌失措
    2021-01-04 09:29

    Run command prompt as administrator and type following command. netstat -ano | findstr ":80"

    • a: Displays all connections and listening ports.
    • n: Displays addresses and port numbers in numerical form.
    • o: Displays the owning process ID associated with each connection.

    In case if you are using a different port number then replace 80 with the appropriate port number.

    The result would show a process id using the 80 port number in the last column. Either you can change the port number in your program or you can kill the process using 80 port number.

提交回复
热议问题