Windows Azure Blob

1

I've been trying to create a Windows Azure Blob containing an image file. I followed these tutorials: http://www.nickharris.net/2012/11/how-to-upload-an-image-to-windows-azure-storage-using-mobile-services/ and http://www.windowsazure.com/en-us/develop/mobile/tutorials/upload-images-to-storage-dotnet/. Finally the following code represents a merging of them. On the last line, however, an exception is raised:

An exception of type 'System.TypeLoadException' occurred in mscorlib.ni.dll but was not handled in user code

Additional information: A binding for the specified type name was not found. (Exception from HRESULT: 0x80132005)

Even the container is created the table, but It doesn't work properly.

private async void SendPicture()
{
    StorageFile media = await StorageFile.GetFileFromPathAsync("fanny.jpg");

    if (media != null)
    {
        //add todo item to trigger insert operation which returns item.SAS
        var todoItem = new Imagem()
        {
            ContainerName = "mypics",
            ResourceName = "Fanny",
            ImageUri = "uri"
        };
        await imagemTable.InsertAsync(todoItem);

        //Upload image direct to blob storage using SAS and the Storage Client library for Windows CTP
        //Get a stream of the image just taken
        using (var fileStream = await media.OpenStreamForReadAsync())
        {
            //Our credential for the upload is our SAS token
            StorageCredentials cred = new StorageCredentials(todoItem.SasQueryString);
            var imageUri = new Uri(todoItem.SasQueryString);

            // Instantiate a Blob store container based on the info in the returned item.
            CloudBlobContainer container = new CloudBlobContainer(
                    new Uri(string.Format("https://{0}/{1}",
                        imageUri.Host, todoItem.ContainerName)), cred);

            // Upload the new image as a BLOB from the stream.
            CloudBlockBlob blobFromSASCredential =
                    container.GetBlockBlobReference(todoItem.ResourceName);
            await blobFromSASCredential.UploadFromStreamAsync(fileStream.AsInputStream());
        }
    }
}
azure
blob
azure-storage
azure-storage-blobs
asked on Stack Overflow Sep 21, 2013 by igorvpcleao • edited Sep 25, 2013 by Mike Guthrie

1 Answer

1

Please use Assembly Binding Log Viewer to see which load is failing. As also mentioned in the article, the common language runtime's failure to locate an assembly typically shows up as a TypeLoadException in your application.

answered on Stack Overflow Sep 30, 2013 by Serdar Ozler

User contributions licensed under CC BY-SA 3.0