简体   繁体   中英

.NET The request was aborted: Could not create SSL/TLS secure channel

I have tried every supposed solution that I've come across for this issue but nothing seems to work. Here are the distilled trace logs (one for trying to talk to Paypal, and the other for trying to talk to GetSentry):

System.Net Information: 0 : [10776] SecureChannel#49633458::.ctor(hostname=svcs.sandbox.paypal.com, #clientCertificates=0, encryptionPolicy=RequireEncryption)
System.Net Information: 0 : [10776] SecureChannel#49633458 - Left with 0 client certificates to choose from.
System.Net Information: 0 : [10776] Using the cached credential handle.
System.Net Information: 0 : [10776] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = (null), targetName = svcs.sandbox.paypal.com, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [10776] InitializeSecurityContext(In-Buffer length=0, Out-Buffer length=58, returned code=ContinueNeeded).
System.Net Information: 0 : [10776] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = 69e8d930e0:cc64028eb0, targetName = svcs.sandbox.paypal.com, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [10776] InitializeSecurityContext(In-Buffers count=2, Out-Buffer length=0, returned code=IllegalMessage).
System.Net Error: 0 : [10776] Exception in HttpWebRequest#2657604:: - The request was aborted: Could not create SSL/TLS secure channel..
System.Net Error: 0 : [10776] Exception in HttpWebRequest#2657604::GetResponse - The request was aborted: Could not create SSL/TLS secure channel..

System.Net Information: 0 : [10776] SecureChannel#39602548::.ctor(hostname=app.getsentry.com, #clientCertificates=0, encryptionPolicy=RequireEncryption)
System.Net Information: 0 : [10776] SecureChannel#39602548 - Left with 0 client certificates to choose from.
System.Net Information: 0 : [10776] Using the cached credential handle.
System.Net Information: 0 : [10776] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = (null), targetName = app.getsentry.com, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [10776] InitializeSecurityContext(In-Buffer length=0, Out-Buffer length=58, returned code=ContinueNeeded).
System.Net Information: 0 : [10776] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = 69e8d930e0:cc64029510, targetName = app.getsentry.com, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [10776] InitializeSecurityContext(In-Buffers count=2, Out-Buffer length=0, returned code=IllegalMessage).
System.Net Error: 0 : [10776] Exception in HttpWebRequest#49716141:: - The request was aborted: Could not create SSL/TLS secure channel..
System.Net Error: 0 : [10776] Exception in HttpWebRequest#49716141::GetResponse - The request was aborted: Could not create SSL/TLS secure channel..

I have tried

ServicePointManager.ServerCertificateValidationCallback +=
                (sender, certificate, chain, sslPolicyErrors) => true;

as well as (Application_Start in Global.asax.cs)

ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;

Nothing seems to help. This is on a Windows 8.1 Pro box in an MVC application.

It looks like the SharpRaven library version I was using was forcing ServicePointManager.SecurityProtocol to SSL3, breaking any subsequent calls. The new library version doesn't do this, but I still set it to TLS explicitly right before executing my call just for good measure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM