Docs: The sample doesn't work

Created on 7 May 2019  Â·  8Comments  Â·  Source: dotnet/docs

I've downloaded the sample and am trying to run the QueueResults app.

When pressing the Start button it writes "Downloads failed." (Actually there's a HttpRequestException: An error occurred while sending the request.)

And the following messages are in the output:
Exception thrown: 'System.Security.Authentication.AuthenticationException' in System.dll
Exception thrown: 'System.ObjectDisposedException' in System.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in mscorlib.dll

And I've tried other samples in "The Task asynchronous programming model in C#" tutorial and none of them work.

I'm using a firewall and have opened it for the app.

And I've tried to connect to the same url via HttpClient.GetByteArrayAsync(url) in a separate test app, and it succeeds.


Document Details

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

Area - C# Guide Technology - Async Task P1 doc-bug up-for-grabs

All 8 comments

The samples actually work if you either:

  • update the project to target .NET Framework 4.6 or newer.
  • or specify to use TLS 1.2 as default connection with the following line of code:
    System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls12;

/cc @BillWagner

What do you suggest to fix the issue?

Updating the sample and/or adding a note mentioning that Tls12 needs to be enable if the targeted framework version is less than 4.6?

@nemrism I think the better fix is to update the sample. Would you agree?

Definitely, @BillWagner, do you recommend to add the instruction whatever .NET FX version the code is run against?

Would you like me to PR this change?

@nemrism I apologize for the late response. I missed this comment.

The main sample should be updated to recommend a version newer than framework 4.6. The 4.6 instructions should be included.

And yes, I'll watch for a PR if you want to submit one.

Your lucky I still got somewhere in my phone a set of open webpages to handle this.
I'll try to work on this in the coming days and let you know.

We're lucky to have great community contributors. Thank you.

Would you believe me if I told you that participating to msdocs on Github made me reconsider this part of my day-to-day job?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Manoj-Prabhakaran picture Manoj-Prabhakaran  Â·  3Comments

Eilon picture Eilon  Â·  3Comments

mekomlusa picture mekomlusa  Â·  3Comments

ite-klass picture ite-klass  Â·  3Comments

skylerberg picture skylerberg  Â·  3Comments