1

I'm trying to test some of the samples for authorize.net in c# located at this url https://github.com/AuthorizeNet/sample-code-csharp/tree/40526f6e763825447ff934ac03eff464bd5dad8a

Whenever I'm launching some of the samples I'm getting this error:

An existing connection was forcibly closed by the remote host error code: 10054

This is the exception I'm getting:

enter image description here

halfer
  • 19,824
  • 17
  • 99
  • 186
Laziale
  • 7,965
  • 46
  • 146
  • 262
  • Who is the remote host? Does it know you? What *exactly* is the mysterious code which is throwing the error? – Andrew Morton Jul 18 '17 at 08:02
  • @AndrewMorton this is where the actual exception happening https://i.gyazo.com/e60bb4c2efd110205f92f8ccdc32930b.png I'm just trying to run one sample so I can see the output. How should the remote host know me? Can you please provide some advice. Thanks – Laziale Jul 18 '17 at 08:29
  • [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). Please post code as text, not as a picture. – Andrew Morton Jul 18 '17 at 09:14
  • Possible duplicate of [An existing connection was forcibly closed by the remote host](https://stackoverflow.com/questions/2582036/an-existing-connection-was-forcibly-closed-by-the-remote-host) – Liam Feb 15 '19 at 11:52

1 Answers1

1

What version of the .Net framework are you using? If you are using .Net framework 4.5, try adding the following at the beginning of the function where you make a webrequest:

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;