c# - 如何将巨大的字节数组保存到azure表存储中?

标签 c# arrays azure large-files azure-table-storage

我有包含 byte[] 属性的 tableEntity

[StorageTableName("TestTable")]
public class TestTableEntity : TableEntity
{
    public byte[] Data { get; set; }
}

在此属性中,我想将一些文件转换为字节(如果不正确 - 请建议其他解决方案)。

var table = tableStorage.Table<TestTableEntity>();
await table.CreateIfNotExistsAsync();

var entity = new TestTableEntity 
{
    Data = data, //byte[]
    PartitionKey = partitionKey, //date
    RowKey = schemaName// string
};

await table.InsertOrUpdateAsync(entity);

在插入步骤中出现错误

The remote server returned an error: (413) The request body is too large and exceeds the maximum permissible limit..

因为数组真的很大。

有什么办法可以解决这个问题吗?

最佳答案

在 Azure 表存储中,实体的最大存储容量约为 1 MB ( Azure Storage Scalability and Performance Targets )。

检查数据是否超出指定限制,在这种情况下您可能需要将数据存储在 Azure Blob 中并在表中添加对其的引用或直接使用它。

关于c# - 如何将巨大的字节数组保存到azure表存储中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45696848/

相关文章:

c# - 尝试将 winforms 应用程序与需要登录的 Web 门户连接

azure - Windows Azure 上推荐的 ElasticSearch 部署是什么?

c# - 如何处理 Linq2Sql 列表中的空值

c# - 将 C# 代码转换为 PowerShell

c# - 交换类实例数组中的值

javascript - 如何将数组的数组转换为对象?

azure - 循环访问 ARM 模板中的值

c# - Azure 持续部署 - Code First 迁移播种问题 (MVC 5)

c# - 将 Expression<Func<DTOUser, bool>> 谓词转换为 Expression<Func<User, bool>> 谓词

java - 获取数组中最大数的索引