简体   繁体   English

Azure存储Blob,C#,如何确定当前使用的Blob?

[英]Azure storage blobs, C#, how can I determine what blob is currently in use?

I am writing console app to list and snaphot/restore azure blobs. 我正在编写控制台应用程序以列出和快照/恢复天蓝色斑点。 As I understand, I can make snapshot, then fully turn off the machine(from azure portal, with deallocate), and copy some snapshot back with overwrite 据我了解,我可以制作快照,然后完全关闭计算机(从azure门户使用deallocate),然后通过覆盖将一些快照复制回来

In this example I'm getting blobs into a collection: 在此示例中,我将blob放入集合中:

        // get storage account based on credentials
        CloudStorageAccount storageAccountObj = new CloudStorageAccount(creds, false);

        // move all blobs to collection
        CloudBlobClient blobClient = storageAccountObj.CreateCloudBlobClient();
        var containers = blobClient.ListContainers();

        List<CloudBlob> blobsArray = new List<CloudBlob>();
        foreach (var container in containers)
        {
            foreach (var listBlobItem in container.ListBlobs())
            {
                var blobItem = (CloudBlob)listBlobItem;
                blobsArray.Add(blobItem);
            }                    
        }

        // display blobs
        DisplayBlobCollection(blobsArray);

But there are blobs with same names but different ETag's: 但是存在名称相同但ETag不同的Blob:

在此处输入图片说明

How can I determine what blob is currently in use by virtual machine? 如何确定虚拟机当前正在使用哪个Blob?

How come you get blobs with same name? 您怎么会得到同名的Blob? Pring out the container name too, it may give you a clue which one is in use by the VM. 还要提供容器名称,这可能会为您提供VM正在使用哪个容器的线索。 There cannot be two blobs with same name within the same container. 同一容器中不能有两个具有相同名称的Blob。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 C# 中的 Azure.Storage.Blobs 以 ByteArray 格式从 Azure 存储 blob 中获取文件 - How to get file from Azure storage blob in a ByteArray format using Azure.Storage.Blobs in C# Azure Blob存储-如何确定指定的容器是否包含任何Blob? - Azure Blob Storage - How to determine if a specified container contains any blobs? C#+ Azure存储Blob:StorageException:当前有一个挂起的复制操作 - C# + Azure Storage blobs: StorageException: There is currently a pending copy operation 如何使用 Azure.Storage.Blobs 程序集对 Azure blob 存储操作设置重试策略? - How do I set a retry policy on an Azure blob storage operation using the Azure.Storage.Blobs assembly? 如何使用 Object c# .NET Core 在 blob 存储 azure 上创建 csv 文件? - How can I create a csv file on blob storage azure with Object c# .NET Core? 如何在C#中确定当前关注进程的名称 - How can I determine the name of the currently focused process in C# 可以在我的 azure function (c#) 中使用不同的 blob 存储连接字符串,具体取决于我是在开发还是生产? - Can use a different blob storage connection string in my azure function (c#) depending if I am in dev or prod? 我如何确定 SAS 令牌是否已针对 Azure Blob 存储容器访问过期? - How can i determine if a SAS Token has already expired for Azure Blob Storage Container Access? 使用yield来推迟Azure blob存储调用 - c# - Use the yield to defer Azure blob storage call - c# 在 Azure Blob 存储中查找所有带有前置的 Blob - Find all blobs with prepend in Azure Blob Storage
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM