我如何(以编程方式)获取 Azure Blob 的最大允许大小?

How can I (programmatically) get Azure Blob maximum allowed size?

是否有任何方法可以通过编程方式检索 Azure Blob 允许的 最大 大小?也用于 blob 中的块?

我知道无法按需查询最大大小,但我相信您要查找的值作为常量存储在 .net SDK 中。 Microsoft.WindowsAzure.Storage.Shared.Protocol 命名空间中的 Constants.MaxBlobSizeConstants.MaxBlockSize 将是您感兴趣的值。

/// <summary>
/// The maximum size of a blob with blocks.
/// </summary>
public const long MaxBlobSize = MaxBlockNumber * MaxBlockSize;

MaxBlockSize 为

/// <summary>
/// The maximum size of a single block for Block Blobs.
/// </summary>
public const int MaxBlockSize = (int)(100 * Constants.MB);

Source (Constants.cs)

取自https://docs.microsoft.com/en-us/azure/storage/storage-dotnet-how-to-use-blobs#writing-to-an-append-blob

Each block in an append blob can be a different size, up to a maximum of 4 MB, and an append blob can include a maximum of 50,000 blocks. The maximum size of an append blob is therefore slightly more than 195 GB (4 MB X 50,000 blocks).

Is there any way to programmatically retrieve the maximum allowed size for an Azure Blob? Also for a block in a blob?

截至今天,没有。没有检索此信息的编程方式。但是,此信息发布得很好 here 并且不会经常更改。自 2008 年以来,我相信大小只发生了一次变化,块 blob 也是如此。

这是今天的限制:

块 Blob

最大大小:4.75 TB(如果您使用服务版本 2016-05-31 或更高版本)

最大大小:195 GB(如果您使用 2016-05-31 之前的服务版本)

最大块大小:100MB(如果您使用服务版本 2016-05-31 或更高版本)

最大块大小:4MB(如果您使用 2016-05-31 之前的服务版本)

最大块数:50000

页面 Blob

最大容量:1TB

附加 Blob

最大容量:195GB

最大块大小:4MB

最大块数:50000