0

I have created a Service bus queue. The URL for this is:

https://ns-eventqueue.servicebus.windows.net/eventqueue

I have also created a Shared Access Policy for this. The Policy name is EventPolicy.

When I try to use this policy and URL to connect to the service bus queue I get the following error:

40400: Endpoint Not Found

What am I doing wrong? Here is the code I am using:

        // Uri to the Service Bus Queue
        Uri uri = ServiceBusEnvironment.CreateServiceUri("sb", "ns-eventqueue", "EventQueue");

        // Shared Access Signature (SAS) Authentication 
        string name = "EventPolicy";
        string key = "TheKeyValue";

        // Token Provider
        TokenProvider tokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider(name, key);

        // Create a Messaging Factory
        MessagingFactory factory = MessagingFactory.Create(uri, tokenProvider);

        string filePath = @"C:\Temp\VTData\Ring Buffer.xml";
        byte[] data = File.ReadAllBytes(filePath);

        BrokeredMessage bm = new BrokeredMessage(data);
        bm.Label = "Ring Buffer File";

        try
        {
            MessageSender sender = factory.CreateMessageSender("EventQueue");
            sender.Send(bm);
        }
        catch (Exception ex)
        {
            throw;
        }
Yasir
  • 1,595
  • 5
  • 23
  • 42

1 Answers1

0

The issue was with the 3rd parameter of ServiceBusEnvironment.CreateServiceUri method. The third parameter was supposed to be blank.

Yasir
  • 1,595
  • 5
  • 23
  • 42