Does anyone know how to force an application using .NET 4.7 to use TLS 1.2 for a secure https request?
I know the client supports TLS 1.2, as I can access the destination https URL fine with Chrome. But the .NET app, using a Microsoft library for talking to an Azure notification hub, is negotiating to use TLS 1.0, which the Azure server stopped supporting at the end of 2020. Packet tracing shows that immediately after the "client Hello" is sent, specifying TLS 1.0, the Azure server immediately closes the socket.
I've followed the instructions here: https://support.microsoft.com/en-us/help/3140245/update-to-enable-tls-1-1-and-tls-1-2-as-default-secure-protocols-in-wi
and here:
2008 R2 TLS 1.2 enabled in registry, rebooted, but not functioning
So I have the SCHANNEL enabling TLS 1.1 and TLS 1.2 for Client and Server
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp
and
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp is set to have TLS 1.1 and 1.2 with a new DefaultSecureProtocols DWORD set to 0x0A00.
Still, the Azure code I'm running throws an exception in System.Net.HttpWebRequest. Wireshark shows it is attempting to connect with TLS 1.0.