Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blob container creation exception

I get an exception every time I try to create a container for the blob

using the following code


CloudStorageAccount storageAccInfo; CloudBlobClient blobStorageType; CloudBlobContainer ContBlob;  blobStorageType = storageAccInfo.CreateCloudBlobClient();  //then I initialize storageAccInfo  ContBlob = blobStorageType.GetContainerReference(containerName); //everything fine till here ; next line creates an exception  ContBlob.CreateIfNotExist(); 

Microsoft.WindowsAzure.StorageClient.StorageClientException was unhandled   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 WebRole1.BlobFun..ctor() in C:\Users\cloud\Documents\Visual Studio 2008\Projects\CloudBlob\WebRole1\BlobFun.cs:line 58        at WebRole1.BlobFun.calling1() in C:\Users\cloud\Documents\Visual Studio 2008\Projects\CloudBlob\WebRole1\BlobFun.cs:line 29        at AzureBlobTester.Program.Main(String[] args) in C:\Users\cloud\Documents\Visual Studio 2008\Projects\CloudBlob\AzureBlobTester\Program.cs:line 19        at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)        at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)        at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()        at System.Threading.ThreadHelper.ThreadStart_Context(Object state)        at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)        at System.Threading.ThreadHelper.ThreadStart()   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:  

Do you guys knw what is it that I am doing wrong ?

like image 291
Egon Avatar asked Apr 12 '10 07:04

Egon


People also ask

What is difference between blob and container?

A container organizes a set of blobs, similar to a directory in a file system. A storage account can include an unlimited number of containers, and a container can store an unlimited number of blobs.

What is a blob container?

Blob storage is a feature in Microsoft Azure that lets developers store unstructured data in Microsoft's cloud platform. This data can be accessed from anywhere in the world and can include audio, video and text. Blobs are grouped into "containers" that are tied to user accounts.


2 Answers

My guess is that the container name you're using violates the naming rules. Check http://msdn.microsoft.com/en-us/library/dd135715.aspx.

like image 162
user94559 Avatar answered Oct 02 '22 12:10

user94559


I've got the same exception. The solution: change container names to lower case.

With exception:

CloudBlobContainer container = blobClient.GetContainerReference("Script"); container.CreateIfNotExist(); 

Works fine:

CloudBlobContainer container = blobClient.GetContainerReference("script"); container.CreateIfNotExist(); 
like image 33
unconnected Avatar answered Oct 02 '22 14:10

unconnected