none
400 Bad Request Connecting to Development Storage using Azure Storage Client ver 2.0

    Question

  • Following four lines of code executed against development storage works fine in ver 1.7
    gives (400) Bad Request in ver 2.0

    CloudStorageAccount account = CloudStorageAccount.DevelopmentStorageAccount;
    CloudBlobClient blobClient = account.CreateCloudBlobClient();
    CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");
    bool wasCreated = container.CreateIfNotExists();

    The code works fine (both ver 1.7 and 2.0) against real Azure Storage Account. Issue is ONLY with development storage.

    What I have tried so far:

    1. Note: This is not about infamous Camelcase container name. I have used all lowercases.
    2. I re-ran dsinit after installing 2.0 Nuget package just to be sure.
    3. Ran Visual Studio as Administrator and regular user
    4. Stopped and re-stated storage emulator
    5. Changed .Net profile from 4.5 to 4.0 (back to 4.5)
    6. Disabled firewall (and re-enabled)

    Above four lines were executed from with in Visual Studio 2012 Express Unit Test Project.
    Any pointers?

    Wednesday, October 31, 2012 4:16 PM

Answers

  • Hello Johnson,turiyatita,

    Apparently there is problem between SDK version and Emulator. I tried sample code with Azure Queue. I too acknowledge that it is working fine with Cloud Azure Storage, only the local emulator version has some problem.

    The Storage Emulator [version 1.6.21103.1459] works fine with SDK [version 1.7.0.0]. I always use Nuget to download the dlls.

    Where are when the same is used with Storage Emulator [version 1.6.21103.1459] works fine with SDK [version 2.0.0.0]. It is giving me 400 Request Error.

    version 1.7

    using Microsoft.WindowsAzure;
    using Microsoft.WindowsAzure.StorageClient;
    
    
    var account = CloudStorageAccount.DevelopmentStorageAccount;
    var queueClient = account.CreateCloudQueueClient();
    
    CloudQueue queue = queueClient.GetQueueReference("myqueue");
    queue.CreateIfNotExist();
    queue.AddMessage(new CloudQueueMessage(" my message " ));            

    version 2.0.0.0

    using Microsoft.WindowsAzure.Storage;
    using Microsoft.WindowsAzure.Storage.Auth;
    using Microsoft.WindowsAzure.Storage.Queue;
    
    var account = CloudStorageAccount.DevelopmentStorageAccount;
    var queueClient = account.CreateCloudQueueClient();
    
    var queue = queueClient.GetQueueReference("myqueue");
    queue.CreateIfNotExists();

    Please note the change the API for CreateIfNotExist[v 1.7.0.0] & CreateIfNotExists[v 2.0.0.0] and other namespace level changes.

    Please find the screenshot of the stack trace of the 400 error for v 2.0.0.0 error with dev emulator.

    Azure Emulator 400 Error v 2.0.0.0

    Regards

    Naveen [http://www.navcode.info]


    Tuesday, November 06, 2012 8:00 AM

All replies

  • Hi, I'm unable to reproduce this issue on my side. Please make sure you're using the latest 2012-10 SDK. Also please remove the reference to Microsoft.WindowsAzure.StorageClient.dll (v1.7), and add a reference to Microsoft.WindowsAzure.Storage.dll (v2.0). The classes in those libraries may conflict with each other.

    Best Regards

    Friday, November 02, 2012 1:38 AM
  • Hello Johnson,turiyatita,

    Apparently there is problem between SDK version and Emulator. I tried sample code with Azure Queue. I too acknowledge that it is working fine with Cloud Azure Storage, only the local emulator version has some problem.

    The Storage Emulator [version 1.6.21103.1459] works fine with SDK [version 1.7.0.0]. I always use Nuget to download the dlls.

    Where are when the same is used with Storage Emulator [version 1.6.21103.1459] works fine with SDK [version 2.0.0.0]. It is giving me 400 Request Error.

    version 1.7

    using Microsoft.WindowsAzure;
    using Microsoft.WindowsAzure.StorageClient;
    
    
    var account = CloudStorageAccount.DevelopmentStorageAccount;
    var queueClient = account.CreateCloudQueueClient();
    
    CloudQueue queue = queueClient.GetQueueReference("myqueue");
    queue.CreateIfNotExist();
    queue.AddMessage(new CloudQueueMessage(" my message " ));            

    version 2.0.0.0

    using Microsoft.WindowsAzure.Storage;
    using Microsoft.WindowsAzure.Storage.Auth;
    using Microsoft.WindowsAzure.Storage.Queue;
    
    var account = CloudStorageAccount.DevelopmentStorageAccount;
    var queueClient = account.CreateCloudQueueClient();
    
    var queue = queueClient.GetQueueReference("myqueue");
    queue.CreateIfNotExists();

    Please note the change the API for CreateIfNotExist[v 1.7.0.0] & CreateIfNotExists[v 2.0.0.0] and other namespace level changes.

    Please find the screenshot of the stack trace of the 400 error for v 2.0.0.0 error with dev emulator.

    Azure Emulator 400 Error v 2.0.0.0

    Regards

    Naveen [http://www.navcode.info]


    Tuesday, November 06, 2012 8:00 AM
  • Try upgrading your local emulator to v1.8 using WebPi.
    Wednesday, November 14, 2012 4:00 PM
  • There was a post in the MSDN Windows Storage Blog- Updated: Known Issues for Windows Azure Storage Client Library 2.0 for .NET and Windows Runtime. I have posted this question to them and they have replied to it. (Scroll down that blog post)

    http://blogs.msdn.com/b/windowsazurestorage/archive/2012/12/10/updated-known-issues-for-windows-azure-storage-client-library-2-0-for-net-and-windows-runtime.aspx?wa=wsignin1.0


    Tuesday, December 11, 2012 8:57 AM
  • I am continuing to see this problem:

    I’m trying to figure out why I can’t seem to create a CloudQueue while debugging and I hope you can help.

    I’m working on a personal project and want to use Azure but when I go to debug with the storage emulator I keep getting an exception, “400 Bad Request”. All the searching I’ve done has suggested updating to the latest Emulator, which I’ve already done. I’m using VS 2012 on Win8.

    I’m using:

    BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;

    TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;AccountName=devstoreaccount1;

    AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==

    As my connection string because I did find an article saying that only one AccountName and key were supported by the latest version. I’ve also tried the UseDevelopmentStorage=true string.

    The code is below

       // Create the queue client

       CloudQueueClient queueClient = AzureStorageAccount.CreateCloudQueueClient();

       // Retrieve a reference to a queue

       CloudQueue queue = queueClient.GetQueueReference("TradingPostSpidyWorkQueue");

       // Create the queue if it doesn't already exist

       queue.CreateIfNotExists();

       return queue;

    Friday, February 15, 2013 5:29 AM
  • You're getting this error because of the queue name. Please check the rules for naming a queue here: http://msdn.microsoft.com/en-us/library/windowsazure/dd179349.aspx

    Friday, February 15, 2013 6:45 AM