Community Feedback

So what do you think about this community of ours? Or Authorize.Net in general? Suggestions for improvement, as well as kudos on what you do like, are always welcome.

Reply
nu
Member
Posts: 3
Registered: ‎06-01-2017

An existing connection was forcibly closed by the remote host

[ Edited ]

Hello.

 

I'm trying to fix my test requests. For now when I'm sending a request to the 'https://apitest.authorize.net/xml/v1/request.api' I'm getting an exception.

 

[SocketException (0x2746): An existing connection was forcibly closed by the remote host]

 TLS 1.2 is enabled, Windows Server 2008 r2. Any suggestions please?

 

Thanks!

Highlighted
Posts: 416
Topics: 0
Kudos: 85
Blog Posts: 0
Ideas: 0
Solutions: 32
Registered: ‎04-28-2017

Re: An existing connection was forcibly closed by the remote host

Try adding the following to your application in order to see what version of TLS your schannel.dll is using:

var response = WebRequest.Create("https://www.howsmyssl.com/a/check").GetResponse();
var responseData = new StreamReader(response.GetResponseStream()).ReadToEnd();
Response.WriteLine(responseData);

If < TLS 1.2 add the following at the beginning of the function where you make a webrequest:

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

 

Powered by NexWebSites.com -
Certified Authorize.net developers
nu
Member
Posts: 3
Registered: ‎06-01-2017

Re: An existing connection was forcibly closed by the remote host

 Thank you @NexusSoftware!

 

Now I'm getting "

The client and server cannot communicate, because they do not possess a common algorithm

" error.

 

I think the reason is that I have a website running on ASP.NET 2,0 & .Net 2.0 so I should upgrade them too ASAP.

Posts: 416
Topics: 0
Kudos: 85
Blog Posts: 0
Ideas: 0
Solutions: 32
Registered: ‎04-28-2017

Re: An existing connection was forcibly closed by the remote host

Yes, .Net version 4.6 supports TLS 1.2 by default. Version 4.5 can be set to use TLS 1.2 using the above mentioned  technique.

Powered by NexWebSites.com -
Certified Authorize.net developers
Member
Posts: 3
Registered: ‎07-24-2017

Re: An existing connection was forcibly closed by the remote host

I have been getting the same error over the last couple of days when i try sending transaction request in SANDBOX environment.

 

I tried with all the required configurations as per the solution(s) suggested in the developer blogs but i can't get reid of this error.

 

Error Details:

 

System.Net.WebException was unhandled

  HResult=-2146233079

  Message=The underlying connection was closed: An unexpected error occurred on a send.

  Source=System

  StackTrace:

       at System.Net.HttpWebRequest.GetResponse()

       at AuthorizeNet.Util.HttpUtility.PostData[TQ,TS](Environment env, TQ request)

       at AuthorizeNet.Api.Controllers.Bases.ApiOperationBase`2.Execute(Environment environment)

       at net.authorize.sample.ChargeCreditCard.Run(String ApiLoginID, String ApiTransactionKey, Decimal amount) in c:\Users\seshag\Documents\Collectors\sample-code-csharp-master\sample-code-csharp-master\PaymentTransactions\ChargeCreditCard.cs:line 68

       at net.authorize.sample.SampleCode.RunMethod(String methodName) in c:\Users\seshag\Documents\Collectors\sample-code-csharp-master\sample-code-csharp-master\SampleCode.cs:line 228

       at net.authorize.sample.SampleCode.SelectMethod() in c:\Users\seshag\Documents\Collectors\sample-code-csharp-master\sample-code-csharp-master\SampleCode.cs:line 63

       at net.authorize.sample.SampleCode.Main(String[] args) in c:\Users\seshag\Documents\Collectors\sample-code-csharp-master\sample-code-csharp-master\SampleCode.cs:line 26

       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)

       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

       at System.Threading.ThreadHelper.ThreadStart()

  InnerException: System.IO.IOException

       HResult=-2146232800

       Message=Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

       Source=System

       StackTrace:

            at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)

           at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)

            at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)

            at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)

            at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)

            at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

            at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

            at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

            at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)

            at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)

            at System.Net.ConnectStream.WriteHeaders(Boolean async)

       InnerException: System.Net.Sockets.SocketException

            HResult=-2147467259

            Message=An existing connection was forcibly closed by the remote host

            Source=System

            ErrorCode=10054

            NativeErrorCode=10054

            StackTrace:

                 at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)

                 at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)

            InnerException:

 

 

Configuration Details of my local machine

 

I am testing the Authorise.NET API with Sample Code Solution downloaded from GIT repository in Visual Studio 2012. I have installed .NET framework 4.6.2 on my Windows.

 

Target .NET version I have set in config files is as follows

 

App.config

<startup>

       <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />

</startup>

 

Packages.config

 

<packages>

<package id="AuthorizeNet" version="1.9.3" targetFramework="net462" />

</packages>

 

I can't even explictly set  to TLS12 in my code as it does not  show me tLS2 option

System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls

 

Would appreciate your support on resolving this issue.

 

Thanks

Sesha

 

Posts: 416
Topics: 0
Kudos: 85
Blog Posts: 0
Ideas: 0
Solutions: 32
Registered: ‎04-28-2017

Re: An existing connection was forcibly closed by the remote host

[ Edited ]

Hello, 

using System.Net;
using System.Security.Authentication;

  In the function where you make your web request, try: 

   const SslProtocols _Tls12 = (SslProtocols)0x00000C00;
   const SecurityProtocolType Tls12 = (SecurityProtocolType)_Tls12;
   ServicePointManager.SecurityProtocol = Tls12;

 

Powered by NexWebSites.com -
Certified Authorize.net developers
Member
Posts: 3
Registered: ‎07-24-2017

Re: An existing connection was forcibly closed by the remote host

I tried as suggested and it worked like a champ! Thanks a lot for your help.

 

Sesha

New Member
Posts: 8
Registered: ‎06-03-2018

Re: An existing connection was forcibly closed by the remote host

hello,

hello,

ive been experiencing similar issues, but with the standard payment API (we're using the java SDK). Turns out this has been happening for months but seems to be occurring more frequently now. Specifically, when we check for NULL on the API response object, it is indeed NULL...maybe 95% of the time the transaction goes through OK. Sometimes the NULL response object is detected almost immediately after making the request, and sometimes it will hang for 20-30 seconds.

Some unknown % of these failures actually resulted in a sucessful payment, which is obviously really really bad be/c we have no record of it.
We've had a few interactions with someone actually at Authorize.net, but it hasn't been helpful at all - they seem to be claiming there is a network connection drop on our end. We are now considering full abandonment of Authorize.net, which is unfortunate. If this issue were extremeley rare, we could live with it...but at this point it's happening too often.


I've also investigated "work-arounds", perhaps through their webhook API or pulling unsettled transactions to try to "reconcile". But this effort might be better spent on integrating with a different gateway provider.

best regards Plex kodi  luckypatcher

craig