gpt4 book ai didi

azure - Windows Azure Blob

转载 作者:行者123 更新时间:2023-12-03 03:18:12 25 4
gpt4 key购买 nike

我一直在尝试创建一个包含图像文件的 Windows Azure Blob。我遵循了这些教程:http://www.nickharris.net/2012/11/how-to-upload-an-image-to-windows-azure-storage-using-mobile-services/http://www.windowsazure.com/en-us/develop/mobile/tutorials/upload-images-to-storage-dotnet/ 。最后,下面的代码代表了它们的合并。然而,在最后一行,出现了一个异常:

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)

即使容器创建了表,但它也无法正常工作。

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());
}
}
}

最佳答案

请使用Assembly Binding Log Viewer查看哪个负载出现故障。正如本文中还提到的,公共(public)语言运行时无法找到程序集通常会在应用程序中显示为 TypeLoadException。

关于azure - Windows Azure Blob,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18938378/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com