0
votes

This might be very basic but I am not able to get it to work for some reason.

I am using Mass transit Azure Service Bus package v 5.5.6 to connect to my service bus queue on Azure.

Following Mass Transit documentation this is how I am trying to create a bus control and start it:

            this.bus = Bus.Factory.CreateUsingAzureServiceBus(sbc =>
            {

                var host = sbc.Host(newUri("sb://<my-servicebus-namespace>.servicebus.windows.net/"), h =>
                {
                    h.SharedAccessSignature(s =>
                    {
                        s.KeyName = "<key-name>";
                        s.SharedAccessKey = "<key>"; 
                        s.TokenTimeToLive = TimeSpan.FromDays(1);
                        s.TokenScope = TokenScope.Namespace;                       
                    });

                 });
            });

            await bus.StartAsync(); 

However it keeps throwing "No such host is known".

at Microsoft.Azure.ServiceBus.Management.ManagementClient.SendHttpRequest(HttpRequestMessage request, CancellationToken cancellationToken) in C:\ApplicationSourceCode\azure-sdk-for-net\sdk\servicebus\Microsoft.Azure.ServiceBus\src\Management\ManagementClient.cs:line 1219

I even tried : "sb://<my-servicebus-namespace>.servicebus.windows.net/<my-queue-name>/" as Host uri

I am using Azure service bus standard tier.

Its working fine using QueueClient in Microsot.Azure.ServiceBus.

I tried pinging the service bus uri and it does exist.

What am I missing?

1

1 Answers

0
votes

It should work, not sure why it isn't. You could change it to use the connection string (copy it from the Azure portal) and pass it, as a string, to the Host method:

cfg.Host(connectionString);

The connection string should include the host, access key, etc. which is parsed and used to configure the host. MassTransit uses that same queue client, so I'm not sure why it wouldn't work for you. Unless you aren't running the bus in the same context as the queue client, such as behind a firewall or something that doesn't propagate DNS.