Unable to read data from the transport connection

[已解决] Unable to read data from the transport connection

10
[Web开发 > ASP.NET]
使用HttpWebRequest出现如下错误:

Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.


  at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
  at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
  at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)

如何解决??
提问时间:2010/10/9 15:45:37 | 提问者:56max | 悬赏:10 | 浏览:8264
最佳答案
你可以重写一个GetWebRequest方法(或者使用这个方法中的参数设置):

protected override WebRequest GetWebRequest(Uri uri)
       {
           HttpWebRequest webRequest = (HttpWebRequest) base.GetWebRequest(uri);

           webRequest.KeepAlive = false;
           webRequest.ProtocolVersion=HttpVersion.Version10;
           return webRequest;
       }
回答时间:2010/10/9 15:52:27 | 回答者:Souidea
其他参考答案(0)
提交失败!请检查错误!错误信息:

注:以上所有信息由网友提供,仅供交流、参考,均不代表盛派网络言论,如果有任何问题或不妥,请立即联系我们

以下信息或许对您有用: