1
votes

When I create a C# Window Form Application and i put in main the following istructions i receive the "400 error: Bad Request"

CloudStorageAccount storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1");
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference("test");
container.CreateIfNotExists();
2
Hey , Is that your Azure Account Name and AccountKey ? - Bhavik Patel
Are you using Storage Client library version 6.0.0? - Gaurav Mantri

2 Answers

3
votes

If you are using Storage Client library version 6.0.0, you can upgrade storage emulator to version 4.2 or above. It is available as part of Azure SDK 2.7.1 for .NET.

https://azure.microsoft.com/en-us/blog/announcing-the-azure-sdk-2-7-1-for-net/

1
votes

You will get this error if you're using Storage Client library version 6.0.0 with Storage Emulator as current version of Storage Emulator is not compatible with the latest version of Storage Client library.

You could do 2 things:

  1. Use older version of storage client library e.g. https://www.nuget.org/packages/WindowsAzure.Storage/5.0.2.
  2. Use a Cloud Storage Account instead of development storage account.