The underlying connection was closed: An unexpected error occurred on a send
2017-05-11 18:19
369 查看
操作系统是Windows Server 2003 x64 SP2,使用Framework 4.0,在使用WebClient访问某些特定的HTTPS站点时,会引发异常:
The underlying connection was closed: An unexpected error occured on a send.
基础连接已关闭,发送时发生错误
从信息上看是ssl认证失败,此错误并不是所有https站点都出现,另外报错的站点,用浏览器或是wget一类的工具访问都正常。挑了一个报异常的网站,查看一下连接信息(用的firefox):
使用了比较新的TLS1.2,开始怀疑操作系统不支持,于是开始翻微软网站,找到一个页面:
https://support.microsoft.com/en-us/help/948963/an-update-is-available-to-add-support-for-the-tls-rsa-with-aes-128-cbc-sha-aes128-sha-and-tls-rsa-with-aes-256-cbc-sha-aes256-sha-aes-cipher-suites-in-windows-server-2003
确认了Server 2003确实不支持,需要打个hotfix,之后再尝试就一切正常了。有遇到相同问题的同学可以参考一下。
Unhandled Exception: System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Authentication failed because the remote party has closed the transport stream. at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result) at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size) at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size) at System.Net.ConnectStream.WriteHeaders(Boolean async) --- End of inner exception stack trace --- |
基础连接已关闭,发送时发生错误
从信息上看是ssl认证失败,此错误并不是所有https站点都出现,另外报错的站点,用浏览器或是wget一类的工具访问都正常。挑了一个报异常的网站,查看一下连接信息(用的firefox):
使用了比较新的TLS1.2,开始怀疑操作系统不支持,于是开始翻微软网站,找到一个页面:
https://support.microsoft.com/en-us/help/948963/an-update-is-available-to-add-support-for-the-tls-rsa-with-aes-128-cbc-sha-aes128-sha-and-tls-rsa-with-aes-256-cbc-sha-aes256-sha-aes-cipher-suites-in-windows-server-2003
确认了Server 2003确实不支持,需要打个hotfix,之后再尝试就一切正常了。有遇到相同问题的同学可以参考一下。
相关文章推荐
- the underlying conncetion was closed an unexpected error occurred on a receive
- Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500 解决办法
- The operation couldn’,An unexpected failure occurred while logging in (Underlying error code -1005).
- Visual Studio通过Web Deploy发布网站报错:An error occurred when the request was processed on the remote computer.
- Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500 解决办法
- Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
- SSMS错误:A connection was successfully established with the server, but then an error occurred during the login process
- System.ServiceModel.CommunicationException:The underlying connection was closed: The connection was closed unexpectedly
- SQL - A connection was successfully established with the server, but then an error occurred during the pre-login handsha
- 当WCF遭遇An existing connection was forcibly closed by the remote host
- IIS7运行ASP程序时出现【An error occurred on the server when processing the URL】
- iis7错误提示An error occurred on the server when processing the URL
- Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The s
- Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server.
- An error occurred on the server when processing the URL解决方法
- Error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server
- Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the serve
- ASP报错:Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the
- An error occurred during the execution of xp_cmdshell. A call to 'LogonUserW' failed with error code: '1385'
- Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The s