Connection Issues¶
This page describes common RabbitMQ connection problems and possible solutions.
Cannot Connect To RabbitMQ¶
Typical exception:
BrokerUnreachableException
Possible causes:
- RabbitMQ server is not running;
- incorrect host name;
- incorrect port;
- firewall restrictions;
- DNS resolution failures.
Verify Host Configuration¶
Verify the configured connection settings.
Example:
var factory = new ConnectionFactory
{
HostName = "localhost",
Port = 5672,
UserName = "guest",
Password = "guest"
};
Check:
- host name;
- port;
- username;
- password;
- virtual host.
Verify RabbitMQ Is Running¶
Verify RabbitMQ is reachable.
PowerShell:
Test-NetConnection localhost -Port 5672
Expected result:
TcpTestSucceeded : True
Authentication Failures¶
Typical exception:
ACCESS_REFUSED
Possible causes:
- invalid username;
- invalid password;
- insufficient permissions;
- invalid virtual host access.
TLS Configuration Issues¶
If TLS is enabled, verify:
- certificates are valid;
- certificates are trusted;
- TLS settings match the server configuration.
Typical symptoms:
AuthenticationException
SslException
Intermittent Disconnections¶
Possible causes:
- network instability;
- broker restart;
- load balancer timeout;
- heartbeat timeout.
Verify:
- RabbitMQ logs;
- network logs;
- channel events.
Consider enabling:
EnableChannelEvents = true;
and subscribing to:
OnChannelEventFired
to observe connection and channel-level events.
Diagnostic Checklist¶
Before investigating application code:
- verify RabbitMQ is running;
- verify network connectivity;
- verify credentials;
- verify virtual host permissions;
- verify TLS configuration;
- inspect RabbitMQ logs.