Finally I solved the problem :D wihu!
In the WebService I had to change:
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
ConfigurationManager.GetSetting("StorageConnectionString"));
to this(almost the same):
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString"));
and then go to => 'Manage nuget packages' in VS12, and install Windows Azure Storage.
Further more I had to move the variable: byte[] f = Convert.FromBase64String(myBase64String);
outside of the method, like this:
byte[] f;
[WebMethod]
public string UploadFile(string myBase64String, string fileName)
{
f = Convert.FromBase64String(myBase64String);
}
And that was it.
So the WebService look like this:
byte[] f;
[WebMethod]
public string UploadFile(string myBase64String, string fileName)
{
f = Convert.FromBase64String(myBase64String);
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString"));
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve a reference to a container.
CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");
// Create the container if it doesn't already exist.
container.CreateIfNotExists();
container.SetPermissions(
new BlobContainerPermissions
{
PublicAccess = BlobContainerPublicAccessType.Blob
});
// Retrieve reference to a blob named "myblob".
CloudBlockBlob blockBlob = container.GetBlockBlobReference(fileName);
using (MemoryStream stream = new MemoryStream(f))
{
blockBlob.UploadFromStream(stream);
}
return "OK";
}
This will send the image as a ByteArray to the Windows Azure Storage.
Next step is to download the file and convert it to a Bitmap image :)
If this was helpfull please give me some points :D