How to fix Service Bus Exception

Priyanka Chadha 0 Reputation points
2025-08-19T21:43:27.99+00:00

Azure.Messaging.ServiceBus.ServiceBusException: An existing connection was forcibly closed by the remote host. ErrorCode: ConnectionReset (ServiceCommunicationProblem). For troubleshooting information, see https://aka.ms/azsdk/net/servicebus/exceptions/troubleshoot.

---> System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host.

at Microsoft.Azure.Amqp.Transport.TransportStream.EndRead(IAsyncResult asyncResult)

at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization)

--- End of stack trace from previous location ---

at System.Net.Security.SslStream.EnsureFullTlsFrameAsyncTIOAdapter

at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder1.StateMachineBox1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)

at System.Net.Security.SslStream.ReceiveHandshakeFrameAsyncTIOAdapter

at System.Net.Security.SslStream.ForceAuthenticationAsyncTIOAdapter

at Microsoft.Azure.Amqp.Transport.TlsTransport.HandleOpenComplete(IAsyncResult result, Boolean syncComplete)

--- End of stack trace from previous location ---

at Microsoft.Azure.Amqp.AsyncResult.EndTAsyncResult

at Microsoft.Azure.Amqp.Transport.TlsTransportInitiator.OnTransportOpened(IAsyncResult result)

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Krishna Chowdary Paricharla 2,390 Reputation points Microsoft External Staff Moderator
    2025-08-19T22:33:23.5633333+00:00

    Hello Priyanka Chadha,

    The error you’re seeing means that the connection to Azure Service Bus was reset by the remote host. In most cases this is a transient network issue and can be resolved with the following steps:

    Enable retries: The SDK has built-in retry policies to handle these transient errors automatically.

    Check network access: Make sure outbound traffic on ports 5671 (AMQP over TLS) or 443 (WebSockets) is allowed and not blocked by a firewall, proxy, or NSG.

    Reuse connections: Create and reuse a single ServiceBusClient instead of opening many new connections, as too many concurrent connections can cause resets.

    Stay updated: Use the latest Azure.Messaging.ServiceBus SDK and supported .NET runtime.

    Check Azure status & logs: Confirm there are no service issues in your region and use Azure Monitor logs/metrics to see if resets follow a pattern.

    This exception doesn’t mean your Service Bus is broken—it’s a common, expected transient error. The best fix is retry logic + stable network configuration.

    For your reference, please follow the documentation provided below.
    Handle Service Bus Exceptions

    Troubleshooting guide for Azure Service Bus

    AMQP in Azure Service Bus

    Best Practices for performance improvements using Service Bus Messaging

    Hope this helps!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.