C#System.Net.WebException:基础连接已关闭:发送时发生意外错误 [英] C# System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send

查看:2157
本文介绍了C#System.Net.WebException:基础连接已关闭:发送时发生意外错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我仅在一台运行Windows Server 2003的服务器上收到此错误:

I'm getting this error on just one server running Windows Server 2003:

System.Net.WebException:基础连接已关闭:发送中发生意外错误.


这是我的代码...有什么想法吗?


Here's my code... Any ideas?

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https:// URL HERE ");
//request.Headers.Add("Accept", "application/xml");
byte[] bytes;
bytes = System.Text.Encoding.ASCII.GetBytes(xml);
request.KeepAlive = false;
request.Accept = "application/xml";
request.ContentType = "application/xml; charset='UTF-8'";
request.ContentLength = bytes.Length;
request.Method = "POST";
request.Timeout = 10000;
request.ServicePoint.Expect100Continue = false;

推荐答案

当客户端计算机无法发送HTTP请求时,会发生此问题.客户端计算机无法发送HTTP请求,因为连接已关闭或不可用.客户端计算机发送大量数据时,可能会出现此问题.要解决此问题,请参阅决议A,D,E,F和O.

This problem occurs when the client computer cannot send an HTTP request. The client computer cannot send the HTTP request because the connection has been closed or is unavailable. This problem may occur when the client computer is sending lots of data. To resolve this problem, see resolutions A, D, E, F, and O.

https://support.microsoft.com/en-us/kb/915599

这篇关于C#System.Net.WebException:基础连接已关闭:发送时发生意外错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆