Answered by:
Error while creating a blob container

Question
-
Hi all,
i am using following code to create a container in local dev env.
_account = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
_client = _account.CreateCloudBlobClient();
_gbsContainer = RoleEnvironment.GetConfigurationSettingValue("ContainerName");
_blobContainer = _client.GetContainerReference(_gbsContainer);
bool status = _blobContainer.CreateIfNotExist();
but the highlighted line throws an exception :
Microsoft.WindowsAzure.StorageClient.StorageClientException was caught
Message="One of the request inputs is out of range."
Source="Microsoft.WindowsAzure.StorageClient"
StackTrace:
at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.get_Result()
at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.ExecuteAndWait()
at Microsoft.WindowsAzure.StorageClient.TaskImplHelper.ExecuteImplWithRetry[T](Func`2 impl, RetryPolicy policy)
at Microsoft.WindowsAzure.StorageClient.CloudBlobContainer.CreateIfNotExist(BlobRequestOptions options)
at Microsoft.WindowsAzure.StorageClient.CloudBlobContainer.CreateIfNotExist()
at AzureStorageLib.StorageClient.Initialize() in E:\AutoDesk\Code\AzureCode\AppRole\AzureStorageLib\StorageClient.cs:line 33
InnerException: System.Net.WebException
Message="The remote server returned an error: (400) Bad Request."
Source="System"
StackTrace:
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at Microsoft.WindowsAzure.StorageClient.EventHelper.ProcessWebResponse(WebRequest req, IAsyncResult asyncResult, EventHandler`1 handler, Object sender)
InnerException:Am i missing somthing in above code?
Thanks in advance.
Vinayak.
- Moved by Brian AurichMicrosoft employee Saturday, October 2, 2010 5:23 PM migration (From:Windows Azure - Archive)
Tuesday, August 3, 2010 9:58 AM
Answers
-
Hi Vinayak,
Can you share the name of the blob container you're trying to create? In general here are the rules for naming a blob container:
The blob container name must be a valid DNS name, confirming to the following naming rules:
1. Blob container names must start with a letter or number, and can contain only letters, numbers, and the dash (-) character.
2. Every dash (-) character must be immediately preceded and followed by a letter or number.3. All letters in a container name must be lowercase.
4. Blob container names must be from 3 through 63 characters long.
Hope this helps.
Thanks
Gaurav Mantri
Cerebrata Software
- Marked as answer by Vinayak_Bhosale Tuesday, August 3, 2010 10:19 AM
Tuesday, August 3, 2010 10:17 AM
All replies
-
Hi Vinayak,
Can you share the name of the blob container you're trying to create? In general here are the rules for naming a blob container:
The blob container name must be a valid DNS name, confirming to the following naming rules:
1. Blob container names must start with a letter or number, and can contain only letters, numbers, and the dash (-) character.
2. Every dash (-) character must be immediately preceded and followed by a letter or number.3. All letters in a container name must be lowercase.
4. Blob container names must be from 3 through 63 characters long.
Hope this helps.
Thanks
Gaurav Mantri
Cerebrata Software
- Marked as answer by Vinayak_Bhosale Tuesday, August 3, 2010 10:19 AM
Tuesday, August 3, 2010 10:17 AM -
Hi Gaurav,
Thank You for your reply!!
The container name that i used was test.container. Notice the (.) seperating two words. But i was really undone by the instructions in Azure training kit that mentioned the following:
The container name must be a valid Domain Name System (DNS) name, conforming to the following naming rules:
- Must start with a letter or number, and can contain only letters, numbers, and the period (.) and dash(-) characters.
- All letters must be lowercase.
- Must be from 3 to 63 characters long.
- A name cannot contain a dash next to a period.Azure guys : You should really be reviewing the content you put on training kit.
Correcting the container name worked for me.
Thanks once again gaurav.
Vinayak.
Tuesday, August 3, 2010 10:29 AM -
I'll pass this along to the folks who own the Training Kit.Tuesday, August 3, 2010 3:22 PM
-
Yes Steve, that would help save some time of other startup guys.
Wednesday, August 4, 2010 8:23 AM