kfrancis / Chargify2

5 stars 7 forks source link

"Authentication failed because the remote party has closed the transport stream" - needs to use TLS 1.2? #9

Open TimS- opened 8 years ago

TimS- commented 8 years ago

Getting this error below - having seen this issue on the sample repo, I'm assuming it's the same issue and the config needs updating in this project? Any ideas?

System.Net.WebException was unhandled by user code
  HResult=-2146233079
  Message=The underlying connection was closed: An unexpected error occurred on a send.
  Source=Chargify2
  StackTrace:
       at Chargify2.Client.Execute[T](RestRequest request)
       at Chargify2.Client.ReadCall(String call_id)
       at [... removed ...]
  InnerException: 
       HResult=-2146232800
       Message=Authentication failed because the remote party has closed the transport stream.
       Source=System
       StackTrace:
            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.CheckCompletionBeforeNextReceive(ProtocolToken message, 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.Net.TlsStream.CallProcessAuthentication(Object state)
            at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
            at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
            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)
kfrancis commented 8 years ago

You need to set ProtocolType to Tls12, yes - that's not a failure - it's expected behavior from Chargify.