1
votes

I have a series of blobs which I would like to process. My program is getting a 404 error, throwing an exception like this:

ErrorCode:BlobNotFound
ErrorMessage:The specified blob does not exist.

The access policy on the container is set properly, and when I paste the logged URI into my browser (for instance, this: https://atpblob.blob.core.windows.net/darkskydata/plot1251time2010-01-02t00:00:01z.json), it downloads fine.

Here is the relevant code:

Console.WriteLine(daily.BlobUri);
 CloudBlockBlob blockBlob = container.GetBlockBlobReference(daily.BlobUri);
 string text;
 using (var memoryStream = new MemoryStream())
 {
  blockBlob.DownloadToStream(memoryStream);
  text = System.Text.Encoding.UTF8.GetString(memoryStream.ToArray());
 }
 Console.WriteLine(text);

What am I doing wrong?

1

1 Answers

3
votes

I believe the problem is with the following line of code:

CloudBlockBlob blockBlob = container.GetBlockBlobReference(daily.BlobUri);

If you look at GetBlockBlobReference documentation, the parameter expected is actually blob's name and not the URL.

Please try changing it to blob's name. For testing purpose, please try the following code:

CloudBlockBlob blockBlob = container.GetBlockBlobReference("plot1251time2010-01-02t00:00:01z.json");

You should not get an error.