Azure Blobs - ArgumentNullException when calling UploadFile()

Posted by Ariel on Stack Overflow See other posts from Stack Overflow or by Ariel
Published on 2012-10-22T18:18:48Z Indexed on 2012/10/22 23:00 UTC
Read the original article Hit count: 166

I’m getting the following exception when trying to upload a file with the following code:

            string encodedUrl = "videos/Sample.mp4"
            CloudBlockBlob encodedVideoBlob = blobClient.GetBlockBlobReference(encodedUrl);
            Log(string.Format("Got blob reference for {0}", encodedUrl), EventLogEntryType.Information);
            encodedVideoBlob.Properties.ContentType = contentType;
            encodedVideoBlob.Metadata[BlobProperty.Description] = description;
            encodedVideoBlob.UploadFile(localEncodedBlobPath);

I see the "Got blob reference" message, so I assume the reference resolves correctly.

Void Run() C:\Inter\Projects\PoC\WorkerRole\WorkerRole.cs (40)
System.ArgumentNullException: Value cannot be null.
Parameter name: value
   at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.get_Result()
   at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.ExecuteAndWait()
   at Microsoft.WindowsAzure.StorageClient.CloudBlob.UploadFromStream(Stream source, BlobRequestOptions options)
   at Microsoft.WindowsAzure.StorageClient.CloudBlob.UploadFile(String fileName, BlobRequestOptions options)
   at EncoderWorkerRole.WorkerRole.ProcessJobOutput(IJob job, String videoBlobToEncodeUrl) in C:\Inter\Projects\PoC\WorkerRole\WorkerRole.cs:line 144
   at EncoderWorkerRole.WorkerRole.Run() in C:\Inter\Projects\PoC\WorkerRole\WorkerRole.cs:line 40

Interestingly, I'm running that same snippet from an on-premises server i.e., outside of Azure and it works correctly.

Ideas welcome, thanks!

© Stack Overflow or respective owner

Related posts about Azure

Related posts about windows-azure-storage