【问题标题】:Azure After GetBlobReference Properties is emptyAzure 后 GetBlobReference 属性为空
【发布时间】:2017-04-27 13:51:52
【问题描述】:

我尝试在 BlobHelper 下载之后或之前获取属性。GetBlobReference() 用于记录,最后我尝试使用 blob.FetchAttributes();但不工作我的属性是空的。我的容器和我的 blob 没有权限

         public static CloudBlob GetBlobReference(string containerName,string fileName)
         {
        var blobClient = GetBlobClient();
        if (blobClient != null)
           {
            var contRef=blobClient.GetContainerReference(containerName);
            return contRef.GetBlobReference(fileName);
            }
        return null;
          }

         var blob = BlobHelper.GetBlobReference(SelectedContainer, 
         fileName);

        if (blob.Properties != null)
        {
          //I try to get Lenght of blob but it is -1
        }

【问题讨论】:

  • 请分享BlobHelper.GetBlobReference的代码。
  • 固定先生 .. :) 还是你的意思是图片?
  • 如果可能,请包含代码。由于BlobHelper.GetBlobReference 是你写的,我不知道你在那里使用了什么SDK 方法。通过查看该代码,我将更容易提供答案。谢谢。
  • 你有权利我现在修好了

标签: azure properties attributes


【解决方案1】:

这是预期的行为。 GetBlobReference 只是在客户端上创建CloudBlob 的一个实例,而不发出网络请求。来自文档link

调用此方法以返回对 this 中任何类型的 blob 的引用 容器。 请注意,此方法不会向 Blob 发出请求 存储。 您可以返回对 blob 的引用,无论它是否 还存在。

如果要填充属性,必须调用 FetchAttributes 或使用 GetBlobReferenceFromServer

【讨论】:

  • 我在获取引用后尝试 fetchattribus 不起作用,我现在尝试 GetBlobReferenceFromServer 将写入结果。
  • 是的,它正在工作 :) 我明白你最重要的是发出网络请求,谢谢你的信息 :)
猜你喜欢
  • 2021-08-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-05-12
  • 2016-05-04
  • 2016-08-02
  • 2011-09-28
  • 1970-01-01
相关资源
最近更新 更多