System.Net.WebException异常:底层连接已关闭:发送时发生意外错误。在社交媒体上致电
问题描述:
我们正在使用Facebook图形API,Spring.Social.Twitter API来检索联系人所有社交媒体调用都失败,从我们的Web应用程序中,从所有API调用中我们都得到相同的异常。System.Net.WebException异常:底层连接已关闭:发送时发生意外错误。在社交媒体上致电
Twitter的API的GetResponse
Exception Type: System.Net.WebException
Exception: The underlying connection was closed: An unexpected error occurred on a send.
StackTrace: at System.Net.HttpWebRequest.GetResponse()
Inner Exception ---------------------------------------------------
Type: System.IO.IOException
Exception: Received an unexpected EOF or 0 bytes from the transport stream.
StackTrace: at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
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.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
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)
Facebook的图形API调用
这是图形API调用堆栈跟踪得到响应
Exception Type: Facebook.WebExceptionWrapper
Exception: The underlying connection was closed: An unexpected error occurred on a send.
StackTrace: at Facebook.HttpHelper.OpenRead()
at Facebook.FacebookClient.Api(HttpMethod httpMethod, String path, Object parameters, Type resultType)
at Facebook.FacebookClient.Get(String path, Object parameters, Type resultType)
Inner Exception ---------------------------------------------------
Type: System.IO.IOException
Exception: Received an unexpected EOF or 0 bytes from the transport stream.
StackTrace: at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
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.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
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)
这是堆栈跟踪所有的API调用。 在此先感谢。
注:如果我修改我的Web配置,一切都开始工作细一些hours.after,对所有的GET请求同样的错误。
答
我已经作出REST服务删除以下行解决这要求
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
一旦这个ServicePointManager.SecurityProtocol
在应用程序中SSL3设置了此将应用于整个Aplication。 之后,所有的Https调用将使用SSL3进行Request.and所做的请求将给我们提供以上错误
声明SSL3协议Facebook,LinkedIn,和Twitter的脆弱性后,可能已经取消了对SSL3。 这里是关于SSL3贵宾https://scotthelme.co.uk/sslv3-goes-to-the-dogs-poodle-kills-off-protocol/
的详细资料