Cannot connect to RabbitMq from an Asp.Net application

558 views
Skip to first unread message

George Mauer

unread,
Nov 20, 2015, 3:24:16 PM11/20/15
to rabbitmq-users
Cross posted from stackoverflow

I have a asp.net mvc application that interacts with RabbitMq. Everything works great locally.

However, on our deployment server it cannot connect


DEBUG|MassTransit.RabbitMqTransport.Integration.RabbitMqConnectionCache|Connecting: muyuser@localhost:5672/|
ERROR|MassTransit.RabbitMqTransport.RabbitMqReceiveTransport|RabbitMQ connection failed: Connect failed: muyuser@localhost:5672/|


What I'm able to gather is this:

  • In order to connect to RabbitMq you need a valid .erlang.cookie in (on windows) your User root
  • As best I can tell, this cookie is created when you install rabbitmq
  • In development we're using localdb which runs as the developer's user (which has this cookie)
  • In production the application runs off of IIS which uses the application pool and the built-in ApplicationPoolIdentity account. Which doesn't have a User folder for the .erlang.cookiefile to live in.

So the question becomes...what now? How is this intended to work?

Obviously we could create a dedicated user for the web application but our system administrator is understandably very reluctant to do this.

Another clue, is that when I tried to RDP, log in as myself and connect to rabbit I found that I could not. After troubleshooting I discovered that my cookie didn't match up with that of others who could! I replaced it with the one from c:\windows\.erlang.cookie and could then connect from cli. It seems possible like there is a cookie installed somewhere for the applicationpoolidentity but it is an incorrect cookie. What is the location where it would go?

Michael Klishin

unread,
Nov 20, 2015, 4:43:49 PM11/20/15
to rabbitm...@googlegroups.com, George Mauer
On 20 November 2015 at 23:24:18, George Mauer (gma...@gmail.com) wrote:
> I have a asp.net mvc application that interacts with RabbitMq.
> Everything works great locally.
>
> However, on our deployment server it cannot connect
>
> DEBUG|MassTransit.RabbitMqTransport.Integration.RabbitMqConnectionCache|Connecting:
> muyuser@localhost:5672/| ERROR|MassTransit.RabbitMqTransport.RabbitMqReceiveTransport|RabbitMQ
> connection failed: Connect failed: muyuser@localhost:5672/|
>
 > What I'm able to gather is this:
>
> In order to connect to RabbitMq you need a valid .erlang.cookie
> in (on windows) your User root
> As best I can tell, this cookie is created when you install rabbitmq
> In development we're using localdb which runs as the developer's
> user (which has this cookie)
> In production the application runs off of IIS which uses the application
> pool and the built-in ApplicationPoolIdentity account. Which
> doesn't have a User folder for the .erlang.cookiefile to live
> in.
>
>
> So the question becomes...what now? How is this intended to work?

Please take a step back and ask yourself what the Erlang cookie is for. It is a shared
secret used by Erlang applications to authenticate to each other. It is not used by RabbitMQ
client libraries with the exception of the Erlang client in direct mode.

See RabbitMQ log file, it very likely will provide a clue.
--
MK

Staff Software Engineer, Pivotal/RabbitMQ


George Mauer

unread,
Nov 20, 2015, 5:00:26 PM11/20/15
to rabbitmq-users, gma...@gmail.com
Thanks for that Michael. So I have no idea where the log would be. According to the rabbitmq page on windows it should be in %APPDATA%/logs. However the default way that RabbitMq installs on windows is as a service that runs under the builtin Local Service account. As far as I know, this does not have an AppData repository.

Michael Klishin

unread,
Nov 20, 2015, 5:18:05 PM11/20/15
to rabbitm...@googlegroups.com, George Mauer
On 21 November 2015 at 01:00:29, George Mauer (gma...@gmail.com) wrote:
> I have no idea where the log would
> be. According to the rabbitmq page(https://www.rabbitmq.com/relocate.html)
> on windows it should be in %APPDATA%/logs. However the default
> way that RabbitMq installs on windows is as a service that runs
> under the builtin Local Service account. As far as I know, this
> does not have an AppData repository.

You can see log path in the management UI (on the overview page).

Or you can see what files are open/used by the process — that's a common thing to do
on other OS'es when there's no access to management UI. 
Reply all
Reply to author
Forward
0 new messages