【发布时间】:2013-11-27 10:00:04
【问题描述】:
当尝试对 Azure 表存储进行批量插入时,我在 CloudTable.ExecuteBatch() 上收到了一个 StorageException:
TableBatchOperation batchOperation = new TableBatchOperation();
foreach (var entity in entities)
{
batchOperation.InsertOrReplace(entity);
}
table.ExecuteBatch(batchOperation);
抛出异常:
Microsoft.WindowsAzure.Storage.StorageException:意外响应 操作代码:6 at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](StorageCommandBase1 cmd, IRetryPolicy 策略, OperationContext operationContext) 中 e:\projects\azure-sdk-for-net\microsoft-azure-api\Services\Storage\Lib\DotNetCommon\Core\Executor\Executor.cs:line 737 在 Microsoft.WindowsAzure.Storage.Table.TableBatchOperation.Execute(CloudTableClient 客户端,字符串 tableName,TableRequestOptions requestOptions, OperationContext operationContext) 中 e:\projects\azure-sdk-for-net\microsoft-azure-api\Services\Storage\Lib\DotNetCommon\Table\TableBatchOperation.cs:line 85 在 Microsoft.WindowsAzure.Storage.Table.CloudTable.ExecuteBatch(TableBatchOperation 批处理,TableRequestOptions requestOptions,OperationContext 操作上下文)在 e:\projects\azure-sdk-for-net\microsoft-azure-api\Services\Storage\Lib\DotNetCommon\Table\CloudTable.cs:line 165 在 Library.Modules.Cloud.TableStorage.StorageTableRepository
1.InsertOrReplaceBatch(List1 实体)
使用TableOperation 正常插入这些实体没有问题。
我在 Internet 上的任何地方或 MSDN 参考资料中都找不到此异常。
【问题讨论】:
-
您能否检查批次中的所有实体 1) 是否具有相同的 PartitionKey 和 2) 一个实体在批次中没有重复多次。根据错误消息,查看批次中的第 7 个实体。该实体正在引起问题。
标签: c# azure azure-storage azure-table-storage