Unable to read data from the transport connection: The connection was closed error in console application

前端 未结 3 795
后悔当初
后悔当初 2021-01-04 13:08

I have this code in console application and it runs in a loop

 try
 {
      HttpWebRequest request = (HttpWebRequest)WebRequest.Create(search);
      request         


        
3条回答
  •  长情又很酷
    2021-01-04 13:45

    I just tried the code, looping 10 times to load google.com and it worked for me. Is there something special about search - perhaps try replacing it with another uri. I did not include findForMatch - I assume it is not doing anything that would cause the exception.

提交回复
热议问题