[Mono-list] Mono, C#, RaspberryPi2 and MS Azure
myusername
diarmaidmurphy1 at gmail.com
Thu Feb 4 07:22:19 UTC 2016
Hi,
Im trying to download blobs from Azure using my Respberry Pi and Raspbian
Jessie. The code is solid, it works fine on my desktop. It appears that mono
does not have azure assemblies capability, but I read that you can use mono
to access azure so I'm wondering if Im making a mistake?
My code:
using System.Collections.Generic;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
using System.Configuration;
namespace CPGetFamilyPhotos
{
class Program
{
static void Main(string[] args)
{
// Retrieve storage account from connection string.
CloudStorageAccount storageAccount =
CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["AzureImagesConnection"].ConnectionString);
// Create the blob client.
CloudBlobClient blobClient =
storageAccount.CreateCloudBlobClient();
// Retrieve a reference to a container.
var container =
blobClient.GetContainerReference("newAdverts").ListBlobs();
// Retrieve filenames from container List
var urls = new List<string>();
int fileName = 1;
foreach (var blob in container)
{
using (var fileStream =
System.IO.File.OpenWrite(@"\home\pi\Pictures\" + fileName + ".jpg"))
{
var blobReference =
blobClient.GetBlobReferenceFromServer(blob.Uri);
blobReference.DownloadToStream(fileStream);
fileName++;
}
}
}
}
}
I also attach the image of the release files on my Pi and the error message.
There is a small overlap in the error message images (Image 2 & 3).
Does anyone have any idea what I'm doing wrong please?
<http://mono.1490590.n4.nabble.com/file/n4667362/new-1.jpg>
<http://mono.1490590.n4.nabble.com/file/n4667362/new-2.jpg>
<http://mono.1490590.n4.nabble.com/file/n4667362/new-3.jpg>
--
View this message in context: http://mono.1490590.n4.nabble.com/Mono-C-RaspberryPi2-and-MS-Azure-tp4667362.html
Sent from the Mono - General mailing list archive at Nabble.com.
More information about the Mono-list
mailing list