在新的Microsoft.WindowsAzure.Storage CloudBlob没有发现什么是它的等效 [英] CloudBlob not found in the new Microsoft.WindowsAzure.Storage what is its equivalent

查看:261
本文介绍了在新的Microsoft.WindowsAzure.Storage CloudBlob没有发现什么是它的等效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我这是用pcated Microsoft.WindowsAzure.StorageClient去$ P $,并已升级到Microsoft.WindowsAzure.Storage以下code,现在我无法使用code以下,因为它是无法识别CloudBlob类,这已被完全去除或有一个等价类,我可以以类似的方式使用

  // BLOB客户端现在
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();//对于这个容器是customerlogo
CloudBlobContainer容器= blobClient.GetContainerReference(容器);
container.SetPermissions(新BlobContainerPermissions {P​​ublicAccess = BlobContainerPublicAccessType.Blob});//斑点参考,这将是在这种情况下,公司名称。它不应该存在,但是如果这样做,将被覆盖。
CloudBlob BLOB = container.GetBlobReference(文件名);


解决方案

与Azure存储客户端库2.0开始,所有斑点必须通过CloudPageBlob或CloudBlockBlob访问,因为CloudBlob基类已被删除。为了得到一个参考具体的BLOB上课的时候​​客户端不知道的类型,请参阅<一个href=\"http://msdn.microsoft.com/en-us/library/azure/microsoft.windowsazure.storage.blob.cloudblobclient.getblobreferencefromserver.aspx\"相对=nofollow> CloudBlobClient.GetBlobReferenceFromServer 和<一个href=\"http://msdn.microsoft.com/en-us/library/azure/microsoft.windowsazure.storage.blob.cloudblobcontainer.getblobreferencefromserver.aspx\"相对=nofollow> CloudBlobContainer.GetBlobReferenceFromServer 。

有关从pre-2.0版本到较新版本的迁移,我会建议读<一个href=\"http://blogs.msdn.com/b/windowsazurestorage/archive/2012/10/29/windows-azure-storage-client-library-2-0-breaking-changes-amp-migration-guide.aspx\"相对=nofollow>的Windows Azure存储客户端库2.0重大更改和放大器;迁移指南。

I had the following code which was using the deprecated Microsoft.WindowsAzure.StorageClient and have upgraded to Microsoft.WindowsAzure.Storage and now I am unable to use the code below as it is not recognising the CloudBlob class, has this been totally removed or is there an equivalent class I can use in a similar manner

//blob client now
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

//the container for this is customerlogo
CloudBlobContainer container = blobClient.GetContainerReference(Container);
container.SetPermissions(new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Blob });

//blob reference, this will be the company name in this case. it should not exist but if it does it will get overwritten.
CloudBlob blob = container.GetBlobReference(fileName);

解决方案

Starting with Azure Storage Client Library 2.0, all blobs must be accessed via CloudPageBlob or CloudBlockBlob, since the CloudBlob base class has been removed. To get a reference to the concrete blob class when the client does not know the type, please see CloudBlobClient.GetBlobReferenceFromServer and CloudBlobContainer.GetBlobReferenceFromServer.

For migration from a pre-2.0 release to a newer version, I would recommend reading Windows Azure Storage Client Library 2.0 Breaking Changes & Migration Guide.

这篇关于在新的Microsoft.WindowsAzure.Storage CloudBlob没有发现什么是它的等效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆