Azure Blob Storage Object reference not set to an instance of an object
<pre><code>  public class StorageService
    {
        CloudStorageAccount storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=leepiostorage;AccountKey=removed for this post");

        public async Task Upload(string id, Stream data)
        {
            CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
            // Retrieve a reference to a container.
            CloudBlobContainer container = blobClient.GetContainerReference("images");

            await container.CreateIfNotExistsAsync();

            container.SetPermissions(
                new BlobContainerPermissions
                {
                    PublicAccess = BlobContainerPublicAccessType.Blob
                }); 


            CloudBlockBlob blockBlob = container.GetBlockBlobReference(id);

            await blockBlob.UploadFromStreamAsync(data, data.Length);
        }

        public async Task UploadBlogPhoto(string id, Stream data)
        {
            CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
            // Retrieve a reference to a container.
            CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");

            await container.CreateIfNotExistsAsync();

            container.SetPermissions(
                new BlobContainerPermissions
                {
                    PublicAccess = BlobContainerPublicAccessType.Blob
                });


            CloudBlockBlob blockBlob = container.GetBlockBlobReference(id);

            await blockBlob.UploadFromStreamAsync(data, data.Length);
        }
    }
</code></pre>

<p>Here is my StorageServices class where I am trying to make use of the second method, "UploadBlogPhoto". The first one works.</p>

<p>Here is the blog controller's method:</p>

<pre><code>[HttpPost]
        public async Task&lt;ActionResult&gt; UploadPhoto(HttpPostedFileBase file)
        {
            if (file != null &amp;&amp; file.ContentLength &gt; 0)
            {
                var fileExt = Path.GetExtension(file.FileName);
                if (fileExt.ToLower().EndsWith(".png") || fileExt.ToLower().EndsWith(".jpg") ||
                    fileExt.ToLower().EndsWith(".gif"))
                {
                    var str = "example";
                    await service.UploadBlogPhoto(str, file.InputStream);
                }
            }
            return RedirectToAction("Index");
        }
</code></pre>

<p>The view with the script:</p>

<pre><code> @using (Html.BeginForm("UploadPhoto", "Blog", FormMethod.Post, new { enctype = "multipart/form-data" }))
            {
                &lt;div class="browseimg"&gt;
                    &lt;input type="file" class="display-none" name="file" id="files" onchange="this.form.submit()" /&gt;
                &lt;/div&gt;
            }
            &lt;button class="btn btn-primary width-100p main-bg round-border-bot" id="falseFiles"&gt;
                Upload billede
            &lt;/button&gt;

 $(document)
       .ready(function () {
           $('#falseFiles')
               .click(function () {
                   $("#files").click();
               });
       });
</code></pre>

<p>So the first method uploads to a container called "images" just fine. When I try to simply add another method that uploads to a second container, I get </p>

<pre><code>Object reference not set to an instance of an object.
</code></pre>

<p>at</p>

<pre><code>await service.UploadBlogPhoto(str, file.InputStream);
</code></pre>

<p>I've triple checked everything, any ideas? Thanks in advance</p>