locked
App Service failing with Network connection closed error RRS feed

  • Question

  • I am invoking logic apps from App Services, this has been working for over an year and started failing from earlier this week (Sunday).  The following is the error stack in the logs:

    System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
       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)
       --- End of inner exception stack trace ---
       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.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
       at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
       at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
       at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
       at System.Net.TlsStream.CallProcessAuthentication(Object state)
       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.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)
       at System.Net.ConnectStream.WriteHeaders(Boolean async)
       --- End of inner exception stack trace ---
       at System.Net.HttpWebRequest.GetResponse()
       at QuickBookWebService.QBService.PostToKubixPOLogicApp(String resultString, String ticket)

    I am able to post to the logic apps trigger directly using PostMan without any issue.  Both App Service and LogicApps are in EastUS region.  I am able to repro the problem with multiple App Service and Logic Apps.  I tried to change the TLS version used by the App Service to 1.2, but still no effect.

    Any ideas on what else we can check?

    Thank you for all your help

    Guru


    Guru

    Tuesday, January 14, 2020 6:45 AM

All replies

  • Hi Guru, there are a number of reasons why you can receive the error, "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host."

    Can you please try scaling up your app service? This might help if you are running into port exhaustion as a B2 instance has more ports over a B1 instance.

    If that does not work, can you please enable web server logs and capture an instance of the error occuring? Can you then provide us with the HTTP status code and the HTTP sub status code? Something like 502.164. The sub status code is important as it helps us narrow down the cause.

    Ultimately, troubleshooting web socket issues is tough on a forum due to needing the ability to access logs on our end, which we can't do in a public forum. Please try the above and if we get blocked, we can work with you further offline.

    Wednesday, January 15, 2020 8:02 AM
  • Is there any update on the issue?

    If the suggested response helped you resolve your issue, do click on "Mark as Answer" and "Up-Vote" for the answer that helped you for benefit of the community.

    Thursday, January 23, 2020 1:30 AM
  • Hello,

    Any update on the issue?

    If the suggested response helped you resolve your issue, do click on "Mark as Answer" and "Up-Vote" for the answer that helped you for benefit of the community.

    Thanks.
    Tuesday, February 4, 2020 6:19 AM
  • I am facing a similar problem, for Logic Apps, see here: https://social.msdn.microsoft.com/Forums/en-US/f254c1b9-7118-452a-8e7d-2bb52f3d50e5/the-underlying-connection-was-closed-an-unexpected-error-occurred-on-a-send?forum=azurelogicapps
    Thursday, March 5, 2020 10:54 PM