3

I am using Nuget version WindowsAzure.Storage 8.1.1 when i use the basic code to add message to storage queue. this is the code snipe found online that i use, it fails on queue.CreateIfNotExists();

CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["AzureWebJobsStorage"]);

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

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

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

// Create a message and add it to the queue.
CloudQueueMessage couldMessage = new CloudQueueMessage(message);
queue.AddMessage(couldMessage);

Using Fiddler here is my request (security has been set xxx )

PUT https://xxxxxx.queue.core.windows.net/queueName HTTP/1.1
User-Agent: Azure-Storage/8.1.1 (.NET CLR 4.0.30319.42000; Win32NT 10.0.10240.0)
x-ms-version: 2016-05-31
x-ms-client-request-id: 95a86bb9-4438-4bf4-8c42-bed8dca317f1
x-ms-date: Wed, 26 Apr 2017 16:00:03 GMT
Authorization: SharedKey xxxxxxxx:xxxxxxxxxx/xxxxxxxx=
Host: xxxxxxxx.queue.core.windows.net
Content-Length: 0
Connection: Keep-Alive

I can see the error message is:

InvalidResourceNameThe specifed resource name contains invalid characters. RequestId:7b234b7d-0003-0040-3ba6-be7d43000000 Time:2017-04-26T16:00:04.8251125Z

6
  • Is your queue name "queueName"? Commented Apr 26, 2017 at 16:12
  • no it is locationdispatchqueue Commented Apr 26, 2017 at 16:15
  • found the problem, THANKS!! i had CloudQueue queue = queueClient.GetQueueReference("queueName"); instead of CloudQueue queue = queueClient.GetQueueReference(queueName); Commented Apr 26, 2017 at 16:17
  • i guess we can't use "queueName" as an actual name of a queue? Commented Apr 26, 2017 at 16:20
  • No we can't. Please see this: learn.microsoft.com/en-us/rest/api/storageservices/fileservices/… Commented Apr 26, 2017 at 16:22

1 Answer 1

4

Just to close this out properly: Azure Storage Queue names must be all lower-case.

All naming conventions are documented here (a different link than provided in comments).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.