简体   繁体   中英

“Could not create SSL/TLS secure channel” in an Azure Web Application

My Azure Web Application needs to connect to various servers (both with and without SSL). This works perfectly as long as I run the application in my local IIS Express or IIS 7.5 on Windows 10.

As soon as I deploy the application to Azure it stops working for certain servers that require SSL (thought not all). If I run it through ssllabs these normally get an A while the ones that work get a B or a C.

So I would assume that .NET on an Azure instance supports less ciphers than I locally support or something like that?

I've tried out this

ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
                        | SecurityProtocolType.Tls11
                        | SecurityProtocolType.Tls12
                        | SecurityProtocolType.Ssl3;

Also tried it without any of the TLS flags, since this is what most people suggested, but it didn't help. According to the below post there was a fix in October but it's December now.
https://social.msdn.microsoft.com/Forums/en-US/ca6372be-3169-4fb5-870f-bfbea605faf6/azure-webapp-webjob-exception-could-not-create-ssltls-secure-channel?forum=windowsazurewebsitespreview

It also has nothing to do with Cloud Flare.

Any ideas? Or maybe to get started, how do I see what cipher my application is trying to use and what is available?

Perhaps SSL3 or Tls1.0 are not supported? I had a similar issue and after switching to this everything worked:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

You can use ssllabs to test which protocols the server you are trying to connect to uses.

https://www.ssllabs.com/ssltest/

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