We are unable to connect to an HTTPS server using WebRequest
because of this error message:
The request was aborted: Could not create SSL/TLS secure channel.
We know that the server doesn't have a valid HTTPS certificate with the path used, but to bypass this issue, we use the following code that we've taken from another StackOverflow post:
private void Somewhere() {
ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(AlwaysGoodCertificate);
}
private static bool AlwaysGoodCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors policyErrors) {
return true;
}
The problem is that server never validates the certificate and fails with the above error. Does anyone have any idea of what should I do?
I should mention that a colleague and I performed tests a few weeks ago and it was working fine with something similar to what I wrote above. The only "major difference" we've found is that I'm using Windows 7 and he was using Windows XP. Does that change something?
In my case, the service account running the application did not have permission to access the private key. Once I gave this permission, the error went away
After many long hours with this same issue I found that the ASP.NET account the client service was running under didn't have access to the certificate. I fixed it by going into the IIS Application Pool that the web app runs under, going into Advanced Settings, and changing the Identity to the
LocalSystem
account fromNetworkService
.A better solution is to get the certificate working with the default
NetworkService
account but this works for quick functional testing.I was having this same issue and found this answer worked properly for me. The key is 3072. This link provides the details on the '3072' fix.
In my case two feeds required the fix:
Something the original answer didn't have. I added some more code to make it bullet proof.
In my case I had this problem when a Windows service tried to connected to a web service. Looking in Windows events finally I found a error code.
Finally it was related with a Windows Hotfix. In my case: KB3172605 and KB3177186
The proposed solution in vmware forum was add a registry entry in windows. After adding the following registry all works fine.
"ClientMinKeyBitLength"=dword:00000200
Apparently it's related with a missing value in the https handshake in the client side.
List your Windows HotFix:
Solution Thread:
https://communities.vmware.com/message/2604912#2604912
Hope it's helps.
I had this problem trying to hit https://ct.mob0.com/Styles/Fun.png, which is an image distributed by CloudFlare on it's CDN that supports crazy stuff like SPDY and weird redirect SSL certs.
Instead of specifying Ssl3 as in Simons answer I was able to fix it by going down to Tls12 like this: