Messaging with RabbitMQ and .NET review part 2: installation and setup


In the previous post we we went through a general introduction of RabbitMq and its terminology. RabbitMq is a message broker that helps to solve communication between disparate systems in a reliable and maintainable manner. It is a very fast and highly scalable open-source messaging system which by default supports the AMQP messaging protocol. We discussed the key terms exchange, binding, queue, connection and channel. We also listed the 4 exchange types which are direct, header exchange, topic and fan-out.

In this post we’ll install RabbitMq on Windows. I have Windows 10 on my laptop but the RabbitMq installation package should work equally well on other versions of Windows. The most recent version of RabbitMq at this time of writing this post is 3.6.4. There may be a later version by the time you read this.


Go to the RabbitMq installation page. Click the following Windows installer link:

RabbitMq Windows installer link

We’ll first need to install Erlang. Click the following link on the Windows installation page:

Install Erlang for RabbitMq link

This will get you to the Erlang page. Select either the 32 or 64 bit installation package depending on your system…:

Erlang installation links for Windows

This will download an installation package. Go through the installation process accepting the defaults. Then go back to the Windows installation on the RabbitMQ page and click the following link:

Install RabbitMq on Windows from

Again, go through the installation process and accept the defaults.

RabbitMQ is by default installed into the Program Files folder in a sub-folder called RabbitMQ Server. Open a Windows command prompt and navigate to the following folder:

C:\Program Files\RabbitMQ Server\rabbitmq_server-3.6.4\sbin

If there’s a newer version number then update the folder name in the command prompt accordingly.

Issue the following command:

rabbitmqctl status

You’ll get a series of status messages in JSON format:

RabbitMq status message in Windows command prompt

The fact that we received all this text confirms that the RabbitMQ server is up and running and can receive messages.

Next enter the following command:

rabbitmq-plugins enable rabbitmq_management

This command will enable the management UI for RabbitMQ for easy administration. The answer should say that a number of plugins have been enabled:

Enable RabbitMq management UI through Windows command prompt

Open a web browser and navigate to the following URL:


This will open the RabbitMQ management login page. The default username and password is “guest”. Click around in the menu a bit. You won’t see much happening yet as there are no queues, no messages, no exchanges etc. Under the Exchanges link you’ll find the 4 exchange types we listed in the introduction. You can add exchanges and queues and other stuff directly here in the GUI but we’ll do that in code instead later on.

We’re done with the RabbitMQ server setup.

There are two things in the management UI that we can take a look at now: users and virtual hosts.

Virtual hosts

A virtual host in RabbitMq is kind of a namespace with which you can isolate groups of exchanges and queues. There can be a virtual host called “accounting” and another called “management”. The exchanges and queues of the accounting virtual host won’t normally have access to those assigned to the management namespace. In other words a virtual host is a container for related resources. Even users can be assigned per virtual host.

Click on the Admin menu item and then select the virtual hosts option:

Virtual hosts link in the RabbitMq management UI

By default there’s a root namespace called “/” with an admin user called “guest” assigned to it. That’s how we logged in in the first place.

Click on “Add a new virtual host” and name it “accounting”:

Adding a new virtual host in RabbitMq

There are no users assigned to it yet. We’ll create a new user in the next section.


Click on the Admin menu item and then select the Users option:

Users link in the RabbitMq management UI

Click on “Add a user” and create a new user called “accountant” with the password “accountant”. I’ll also add the tag “accountancy”:

Adding a new user in RabbitMq

Click on the name of the new user in the list of users so that we can edit it further. We can in particular set the permissions for this new user:

Set permissions for the new user in RabbitMq

The Virtual Host drop-down list allows us to set which virtual host the new user will have access to. Then come three text fields with regular expressions: configure, write and read. These specify the configure, write and read access level to the resources in the given virtual host for the user. The default value is “.*” which allows access to all exchanges and queues in the virtual host. E.g. the regular expression “^account” means that we give access to all resources whose name starts with “account”. We’ll leave the full access variants untouched for now. Click the Set permission button.

If you’re done creating the new user then log out from the RabbitMq management GUI. Now try to log in with the new user “accountant”. It should fail. The reason is that our tag “accounting” doesn’t follow the set of predefined roles available in RabbitMq. Log in with “guest” and go to the update section for the user “accountant”. Click the “?” link to the right of the Tags field to see which predefined values there are and what roles are attached to them:

RabbitMq default roles and user tags

Update the user to have the “administrator” tag. Log out and log in with the “accountant” user. It should work this time. Note that this tag is only necessary for the management UI. If you don’t want the user to be able to log on to the management console then give it a new tag like “accountancy” which has no predefined roles attached.

In the next post we’ll start looking at some C# code.

View the list of posts on Messaging here.


About Andras Nemes
I'm a .NET/Java developer living and working in Stockholm, Sweden.

3 Responses to Messaging with RabbitMQ and .NET review part 2: installation and setup

  1. ramessesx says:

    Thanks Andras, very informative

  2. Alexander DiMauro says:

    Unfortunately, I can’t get RabbitMQ to work on my Windows 10. When I run rabbitmqctl status, I get the error:

    * TCP connection succeeded but Erlang distribution failed
    * Authentication failed (rejected by the remote node), please check the Erlang cookie

    Googled it and every attempt to fix has failed.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


A great site

iReadable { }

.NET Tips & Tricks

Robin Sedlaczek's Blog

Developer on Microsoft Technologies

HarsH ReaLiTy

A Good Blog is Hard to Find

Softwarearchitektur in der Praxis

Wissenswertes zu Webentwicklung, Domain-Driven Design und Microservices

the software architecture

thoughts, ideas, diagrams,enterprise code, design pattern , solution designs

Technology Talks

on Microsoft technologies, Web, Android and others

Software Engineering

Web development

Disparate Opinions

Various tidbits

chsakell's Blog

Anything around ASP.NET MVC,WEB API, WCF, Entity Framework & AngularJS

Cyber Matters

Bite-size insight on Cyber Security for the not too technical.

Guru N Guns's

OneSolution To dOTnET.

Johnny Zraiby

Measuring programming progress by lines of code is like measuring aircraft building progress by weight.

%d bloggers like this: