gpt4 book ai didi

Azure GetBlobReference 属性后为空

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

我尝试在 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
}

enter image description here

最佳答案

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

Call this method to return a reference to a blob of any type in this container. Note that this method does not make a request against Blob storage. You can return a reference to the blob whether or not it exists yet.

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

关于Azure GetBlobReference 属性后为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43659870/

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