My first attempt to connect my ServiceStack based API to a RabbitMq instance.
I have defined a dummyUser on the RabbitMq side
and added the following in my Configure routine:
container.Register<IMessageService>(c => new RabbitMqServer("amqp://dummyUser:P4ssw0rd@localhost:5672"));
var mqServer = container.Resolve<IMessageService>();
mqServer.RegisterHandler<ServiceModel.Hello>(ExecuteMessage);
mqServer.S`indent preformatted text by 4 spaces`tart();
When I start my API I get the following error message in the console:
fail: ServiceStack.RabbitMq.RabbitMqServer[0]
Exception in Rabbit MQ Server: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=403, text="ACCESS_REFUSED - access to exchange 'mx.servicestack' in vhost '/' refused for user 'dummyUser'", classId=40, methodId=10, cause=
RabbitMQ.Client.Exceptions.OperationInterruptedException: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=403, text="ACCESS_REFUSED - access to exchange 'mx.servicestack' in vhost '/' refused for user 'dummyUser'", classId=40, methodId=10, cause=
at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply(TimeSpan timeout)
at RabbitMQ.Client.Impl.ModelBase.ModelRpc(MethodBase method, ContentHeaderBase header, Byte[] body)
at RabbitMQ.Client.Framing.Impl.Model._Private_ExchangeDeclare(String exchange, String type, Boolean passive, Boolean durable, Boolean autoDelete, Boolean internal, Boolean nowait, IDictionary`2 arguments)
at RabbitMQ.Client.Impl.AutorecoveringModel.ExchangeDeclare(String exchange, String type, Boolean durable, Boolean autoDelete, IDictionary`2 arguments)
at ServiceStack.RabbitMq.RabbitMqExtensions.OpenChannel(IConnection connection)
at ServiceStack.RabbitMq.RabbitMqServer.Init()
at ServiceStack.RabbitMq.RabbitMqServer.Start()
Hosting environment: Development
However I do manage to get a connection:
What am I doing wrong? Why do I get this error in the console?
OS: win10
Framework: .Net Core 2.1
ServiceStack: 5.4.1
RabbitMq: see pictures.