从Windows Phone将图像上载到Azure blob存储。 没有创造

我使用Windows Azure在我的Windows Phone应用程序中存储图像。

相机拍摄照片,然后上传所选的照片流。 但它没有错误,但没有上传?

var blobContainer = CloudStorageContext.Current.Resolver.CreateCloudBlobClient(); var container = blobContainer.GetContainerReference("pics"); var blob = container.GetBlobReference("picture.jpg"); blob.UploadFromStream(e.ChosenPhoto, response => { MessageBox.Show(blob.Uri.ToString()) }); 

我不知道发生了什么。 解析器包含正确的用户,密钥和URL。 容器“pics”确实存在,但没有上传图像。 弹出的消息框中包含一个不存在的URL。

更新 – 这里似乎有一个类似的(几乎完全相同的)问题 – 在WP7中将照片流从相机上传到azure blob 。 但是大写容器名称在这里不是问题,所以解决方案没有解决这个问题

我有一个应用程序(Windows Phone 8),它将拍摄的图像上传到Azure webrole,然后将该图像存储在Azure存储Blob中。 下面的代码是服务器如何存储图像。 同样,此代码不能在手机上运行,​​但您可以将其用作参考。

  string randomGUID = locationID + "-" + Guid.NewGuid().ToString(); //Retrieve storage account from application settings CloudStorageAccount storageAccount = GetStorageAccount(); //Create blob client CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient(); //Retrieve reference to images container CloudBlobContainer container = blobClient.GetContainerReference( RoleEnvironment.GetConfigurationSettingValue("BlobContainer")); //Retrieve references to the blob inside the container CloudBlockBlob blockBlob = container.GetBlockBlobReference(randomGUID); blockBlob.UploadFromStream(imageToUpload); 

变量imageToUpload属于Stream类型。

如您所见,这是非常简单的代码。 也许你的问题与你在UploadFromStream的lambda表达式UploadFromStream