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

前端 未结 3 791
后悔当初
后悔当初 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:21

    After adding

    request.KeepAlive = false;
    request.ProtocolVersion = HttpVersion.Version10; 
    

    it works fine..

    I found it form this blog post

    WebRequest and Unable to read data from the transport connection Error

提交回复
热议问题