Reputation: 3091
I have following code in .NET Framework 4.7.1:
using (var handler = new HttpClientHandler())
{
handler.SslProtocols = SslProtocols.Tls12;
...
}
This code works on my development machine (Windows 10 Enterprise, Build 17101/rs4_release. 180211-1040; Version 1803; OS Build 17101.1000).
The same code (when published to service fabric cluster nodes which already have .net framework 4.7.1 installed) causes following exception:
System.PlatformNotSupportedException: Operation is not supported on this platform.
The cluster nodes are running Windows Server 2012 R2 Data Center, Version 6.3 (Build 9600)
When the code is decompiled using Resharper, my desktop shows the following information:
// Type: System.Net.Http.HttpClientHandler
// Assembly: System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// MVID: 7D453494-012A-4FA4-9E04-1C64E3A0FB6F
// Assembly location: C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Net.Http\\v4.0_4.0.0.0__b03f5f7f11d50a3a\\System.Net.Http.dll
and it shows following on the another local server machine:
// Type: System.Net.Http.HttpClientHandler
// Assembly: System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// MVID: 641F4770-704A-420A-A419-A4FAF4195ADD
// Assembly location: C:\Windows\Microsoft.NET\Framework\\v4.0.30319\\System.Net.Http.dll
As you can see the assembly locations are different, but I don't know what this means. In addition, my local machine has this value for registry key:
"Software\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full\\Release": "461802"
and cluster node has this:
"Software\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full\\Release": "461310"
The documentation on how to determine the installed framework version says:
On all other OS versions: 461310
but the version "461802" from my machine is not even listed there!
Can someone please provide guidance on how to get past this error (without changing my code)?
Upvotes: 1
Views: 1865
Reputation: 3249
While you shouldn't have posted the issue in the dotnet/announcement repo I'm not sure why people downvote your question here; it's a legitimate issue.
The property HttpClientHandler.SslProtocols
was added in .NET Framework 4.7.1 but wasn't actually implemented (you can call this a bug).
This is fixed with .NET Framework 4.7.2, which is probably the reason it works on your development machine.
Upvotes: 9