I've inherited a CLR class library (.NET Framework 4.7.2) that provides a function which queries table storage in Azure. The function, called from a native C++ executable, is currently failing because the TLS settings are insufficient.
If I query what the ServicePointManager.SecurityProtocol
property is set to at the start of the function, I find it set to SSl3|Tls
(both deprecated!). I have to explicitly set it to Tls12 to get the function to work.
If, instead, I create a new CLR console app project (also Framework 4.7.2) and add a function which simply queries the security protocol, I find it's set to SystemDefault
.
Would I be right in thinking that having the function in a class library prevents the security protocol being initialised? Must I explicitly set the ServicePointManager.SecurityProtocol
property in this scenario? Presumably .NET Framework is performing some initialisation when the app is managed, but not in the case of a class library. If true, can anyone expand on this a little?
Also, by setting it to Tls12 am I potentially breaking other calling code, e.g. old code which is happy with Tls11, or future code which insists on Tls13?