Reputation: 1092
I am trying to write a test app that will allow me to access Azure Blob Storage. I am using VS2013 and have Azure SDK V2.2 installed. The Azure Storage Emulator is running. However, the location used by the storage emulator
C:\Users[UserName]\AppData\Local\dftmp\wadd
seems to be different to the location used in VS2013 IDE. I'm not sure where that location is. I can create a container and upload files using the VS2013 IDE, but I then don't see them in the Storage Emulator location, so I have assumed they are different.
More simportantly, the code below fails with a The remote server returned an error: (400) Bad Request. error when it executes the line:
blobContainer.CreateIfNotExists();
Any ideas what is going on and why I can't get this to work in VS2013 using the emulator? It works just fine if I substitute my actual Azure credentials and write the file to the Azure Storage. I really want to build this test solution and do some debugging before moving a solution completely onto Azure.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
// Storage Emulator credentials
string connectionString = "UseDevelopmentStorage=true";
string myContainer = "images";
CloudStorageAccount cloudStorageAccount;
CloudBlobClient blobClient;
CloudBlobContainer blobContainer;
BlobContainerPermissions containerPermissions;
StorageCredentials storageCredentials;
private void InitialiseBlobStorage()
{
cloudStorageAccount = CloudStorageAccount.Parse(connectionString);
blobClient = cloudStorageAccount.CreateCloudBlobClient();
blobContainer = blobClient.GetContainerReference(myContainer);
blobContainer.CreateIfNotExists();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
InitialiseBlobStorage();
// Add code to upload image here
}
}
Upvotes: 1
Views: 69