How to insert Message from visual studio C # to Queue no Azure?

0

To insert message into the queue I ran this code which seems to be correct and yet it still does not work I do not know why the error it gives (in the addmessage part is 404 not found and from what I saw on the net the connections seem be well done.

What's green was another attempt to do the same thing in another way.

What could be causing this error and how can I fix this?

    
asked by anonymous 01.08.2018 / 00:36

1 answer

0

To insert a message into an existing queue, first create a new CloudQueueMessage. Then call the AddMessage method. A CloudQueueMessage can be created through a string (in UTF-8 format) or a byte array. This is the code that creates a queue (if it does not exist) and inserts the message 'Hello, World':

// Retrieve storage account from connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
    CloudConfigurationManager.GetSetting("StorageConnectionString"));

// Create the queue client.
CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();

// Retrieve a reference to a queue.
CloudQueue queue = queueClient.GetQueueReference("myqueue");

// Create the queue if it doesn't already exist.
queue.CreateIfNotExists();

// Create a message and add it to the queue.
CloudQueueMessage message = new CloudQueueMessage("Hello, World");
queue.AddMessage(message);

Source: Introduction to Azure Message Queue > How to insert a message in the queue

    
23.08.2018 / 08:06