views:

297

answers:

3

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.Task1.get_Result() at Microsoft.WindowsAzure.StorageClient.Tasks.Task1.ExecuteAndWait() at Microsoft.WindowsAzure.StorageClient.TaskImplHelper.ExecuteImplWithRetry[T](Func2 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, EventHandler1 handler, Object sender) InnerException:


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

A: 

Based on your code snippet, it looks like you're calling CreateBlobClient() prior to initializing storageAccInfo. I'd imagine this would cause you trouble.

David Makogon
I just skipped that line. Comment indicates the line where storageAccInfo is intialized.
Egon
Sorry - maybe I misunderstood. But where you have the comment is "after" your call to CreateBlobClient, and it should occur "before" the call. Wasn't trying to be pedantic.
David Makogon
+6  A: 

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

smarx
All letters in a container name must be lowercase.Thank you! Fixed
Egon
A: 

Hi,

This is often caused by either a container name with upper case letters in it, or your service account name (AccountName= in the config file) contains upper case letters. This is SO lame. Can somebody tell Microsoft that these are 101 anti-patterns. The Azure console environment permits you to enter an account name, "LameDuck" for example, but you have to connect with AccountName=lameduck, or it blows up in your face with an unintelligible error message. When you enter LameDuck in the Azure console, it does not even warn you that it will blow up in your face if you use precisely this name. This is a waste of OUR time, since we at least expect consistent anti-patterns -- too much to expect? If you don't allow connections with upper case, then don't allow the accounts to be created with upper case names in the Azure console! But you should be able to handle upper case these days. Jeees!

Richard
please went your anger by means of comments not answers!
Egon