Setting the file. One moment.
Chapter 15 · Azure Diagnostics
Subchapter 15.41
troubleshooting/messaging/azure-servicebus-dotnet.mdMarkdown3 KBView on GitHub
Package: Azure.Messaging.ServiceBus | README |
| Exception | Reason | Fix |
|---|---|---|
ServiceBusException (ServiceTimeout) | Service didn’t respond | Transient — auto-retried. For session accept, means no unlocked sessions |
ServiceBusException (MessageLockLost) | Lock expired or link detached | Renew lock, reduce processing time, check network |
ServiceBusException (SessionLockLost) | Session lock expired | Re-accept session, renew lock before expiry |
ServiceBusException (QuotaExceeded) | Too many concurrent receives | Reduce receivers or use batch receives |
ServiceBusException (MessageSizeExceeded) | Message or batch too large | Reduce payload. Premium tier supports individual messages up to 100MB. Batch limit is artificially computed on the client from the max message size sent by the service, so batches can also be impacted |
ServiceBusException (ServiceBusy) | Request throttled | Auto-retried with 10s backoff. See throttling docs (opens in a new tab) |
UnauthorizedAccessException | Bad credentials | Verify connection string, SAS, or RBAC roles |
try { /* receive messages */ }
catch (ServiceBusException ex) when (ex.Reason == ServiceBusFailureReason.ServiceTimeout)
{
// Handle timeout
}ServiceBusClient as singleton. Each creates a new AMQP connection. Always call CloseAsync/DisposeAsync.SessionIdleTimeout to reduce wait time between sessions.ServiceBusClient.CreateSender with via entity support.ServiceBusTransportType.AmqpWebSockets when AMQP ports (5761, 5762) are blocked.