Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An existing connection was forcibly closed by the remote host #11

Open
iiminov opened this issue Jun 1, 2021 · 0 comments
Open

An existing connection was forcibly closed by the remote host #11

iiminov opened this issue Jun 1, 2021 · 0 comments

Comments

@iiminov
Copy link

iiminov commented Jun 1, 2021

Has anyone else experienced the above issue with Wonde client?

  {
    "Message": "An error has occurred.",
    "ExceptionMessage": "An existing connection was forcibly closed by the remote host",
    "ExceptionType": "System.Net.Sockets.SocketException",
    "StackTrace": "   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)"
  }

From recent experience with MS Graph Api and Microsoft depricating TLS 1.0 and TLS 1.1 security protocols (as of mid February) I had to deal with this exact issue where HttpClient kept dropping connection on some endpoints.

Upgrading my project to .Net 4.6.1 partly fixed the issue. But to completely get around the issue I had to explicitly set security protocols while HttpClient was instantiated as below.

  // handle TLS protocols
  System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls | System.Net.SecurityProtocolType.Tls11 | System.Net.SecurityProtocolType.Tls12;

  HttpClientHandler handler = new HttpClientHandler()
  {
    UseDefaultCredentials = true
  };

  MicrosoftGraphApiClient = new HttpClient(handler);
  MicrosoftGraphApiClient.DefaultRequestHeaders.Accept.Clear();
  MicrosoftGraphApiClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

Is there any way to do something similar with Wonde.Client()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant