Azure Blobs - ArgumentNullException when calling UploadFile()
- by Ariel
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!