locked
Connect to Azure Stack - Storage Account (Queue) from C# - 400 Bad Request - The value for one of the HTTP headers is not in the correct format. RRS feed

  • Question

  • Hi.

    I have a storage account in Azure Stack TP3 Refresh. I'm using Azure Storage Explorer and have it connected to the storage account. There I can see a storage queue in my storage account. A can create messages and delete them in Storage Explorer. 

    My problem is when I'm trying to send queue messages to my queue from code (C#). I think it's something with the configuration maybe. I have tried to change the endpointsuffix to match azure stack in my config file.

    DefaultEndpointsProtocol=https;AccountName=[myaccountname];AccountKey=[myKey];EndpointSuffix=local.azurestack.external;

    In my C# code I have a CloudStorageAccount variable: storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]);

    And it gets (what I can see) a correct URI: https://[myaccount].queue.local.azurestack.external

    I send messages like this:

     queueClient = storageAccount.CreateCloudQueueClient();           

    queue = queueClient.GetQueueReference("myQueueName");           

    queue.CreateIfNotExistsAsync(); 

    var cloudQueueMessage = new CloudQueueMessage("testmessage");               

    await queue.AddMessageAsync(cloudQueueMessage);


    The error I get is: 

    The remote server returned an error: (400) Bad Request. StatusMessage:The value for one of the HTTP headers is not in the correct format.

    I'm using the package: Microsoft.WindowsAzure.Storage 7.0.0.0

    Is there another NuGet package for Azure Stack ?

    The solution works with the storage emulator (if I change the connection-string). 


    Jimmy J

    Wednesday, June 14, 2017 1:48 PM

Answers

  • Finally it's working. The solution is that you can not have the latest version of the NuGet package Microsoft.WindowsAzure.Storage. You have to run version 6.1.0 against the Azure Stack.

    Jimmy J

    • Marked as answer by jijaTS Monday, June 26, 2017 7:10 AM
    Monday, June 26, 2017 7:10 AM

All replies