Skip to content

The ServicePointManager security protocol does not work on Windows 7 #13787

Closed

Description

@jozefizso

> If your app targets .NET Framework 4.7 or later versions
> The following sections show how to verify you're not using a specific TLS or SSL version.

> For HTTP networking
> ServicePointManager, using .NET Framework 4.7 and later versions, defaults to the OS choosing the best security protocol and version. To get the default OS best choice, if possible, don't set a value for the SecurityProtocol property. Otherwise, set it to SystemDefault.

This recommendation does not work on Windows 7 Service Pack 1 with .NET Framework 4.7.2 and application targeting 4.7.2

In this configuration, the HttpClient will not connect to the TLS 1.2 server.

Downloading data with HttpClient.GetStringAsync("https://docs.microsoft.com/") on Windows 7 will fail:

Environment.Version: 4.0.30319.42000
ServicePointManager.SecurityProtocol: SystemDefault
Downloading from 'https://docs.microsoft.com/'

HttpRequestException: An error occurred while sending the request.
WebException: The underlying connection was closed: An unexpected error occurred on a send.
IOException: Authentication failed because the remote party has closed the transport stream.

Only solution is to set ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 which defeats the purpose of SystemDefault setting.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Activity

  1. Thraka commented on Aug 9, 2019

    @Thraka
    Contributor

    Is TLS 1.2 enabled by default for your Windows 7 install? I've looked around online and on forums and it doesn't seem to indicate this is the default for the OS.

  2. self-assigned this
    on Aug 9, 2019
  3. added
    needs-more-info
    on Aug 9, 2019
  4. jozefizso commented on Aug 9, 2019

    @jozefizso
    ContributorAuthor

    This is a fully patched Windows 7 SP1 machine which can correctly load TLS 1.2 sites.

    PS: documentation clearly states it will select the most secure protocol version.

  5. Thraka commented on Aug 9, 2019

    @Thraka
    Contributor

    I just noticed that the article has a link to a specific issue to discuss this. At the end of the issue is a recent comment: #4675 (comment)

    This states that even though TLS 1.2 is supported, its not set as the default by the Windows 7 OS (probably so as to not instantly break all existing apps that expect a lower TLS?) and you'll still have to enable it.

    Actually, at the end of the article it lists the problem I think you're running into specifically: https://docs.microsoft.com/en-us/dotnet/framework/network-programming/tls#support-for-tls-12

    image

  6. Thraka commented on Aug 9, 2019

    @Thraka
    Contributor

    Specifically though, there is an engineer or support person on that linked thread, I would post there for help or clarification. They can also update the documentation if something isn't as clear as it should.

    With that in mind, I'm going to close this issue. If the linked information doesn't seem to help (or I've just misunderstood the problem, again) please continue on the linked thread. Hope I've helped a bit a least 😄

  7. removed
    needs-more-info
    on Aug 9, 2019
  8. added this to the August 2019 milestone on Aug 9, 2019
  9. 6 remaining items

  10. jozefizso commented on Aug 12, 2019

    @jozefizso
    ContributorAuthor

    This is a potential breaking change

    This is a real breaking change which makes applications to silently switch to insecure TLS protocol just by re-targeting to .NET 4.7.1.

  11. jozefizso commented on Aug 12, 2019

    @jozefizso
    ContributorAuthor

    allow the OS to tell it what security protocol to use

    This is false - .NET 4.7.x app will ignore supported TLS protocols and it will connect only using the default protocol.

  12. reopened this on Aug 12, 2019
  13. assigned and unassigned on Sep 5, 2019
  14. added a commit that references this issue on Sep 6, 2019
    15d5ceb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions