gpt4 book ai didi

c# - 尝试使用 C# BlobClient 删除租用的 blob 时收到错误 "There is currently a lease on the blob and no lease ID was specified"?

转载 作者:行者123 更新时间:2023-12-03 05:31:28 24 4
gpt4 key购买 nike

我有一个正在访问的 Blob:

BlobContainerClient blobContainerClient = blobServiceClient.GetBlobContainerClient(Container);

BlobClient blobClient = blobContainerClient.GetBlobClient(key);
BlobLeaseClient blobLeaseClient = blobLeaseClientWrapper.GetBlobLeaseClient(blobClient);

blobLeaseClient.Acquire(TimeSpan.FromSeconds(60));

当我使用以下方法删除 blob 时:

blobClient.Delete();

我收到错误:

There is currently a lease on the blob and no lease ID was specified in the request

我尝试解除租约,但仍然遇到相同的错误:

blobLeaseClient.Break();
blobClient.Delete();

如何删除租用的 blob?

最佳答案

这似乎没有很好的记录。我能找到的唯一引用是这个unhelpful response in the MSdocs github site和这个关于 VMs from 2013 的老问题.

在类中进行一些挖掘发现了这个重载,这似乎解决了问题:

 blobClient.Delete(DeleteSnapshotsOption.IncludeSnapshots, new BlobRequestConditions()
{
LeaseId = blobLeaseClient.LeaseId
});

关于c# - 尝试使用 C# BlobClient 删除租用的 blob 时收到错误 "There is currently a lease on the blob and no lease ID was specified"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65038066/

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