当试图做一个批量插入到Azure的表存储,我得到一个StorageException
上CloudTable.ExecuteBatch()
:意外的响应代码(..)
TableBatchOperation batchOperation = new TableBatchOperation();
foreach (var entity in entities)
{
batchOperation.InsertOrReplace(entity);
}
table.ExecuteBatch(batchOperation);
抛出异常:
Microsoft.WindowsAzure.Storage.StorageException:意外的响应 代码操作:6在 Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync [T](StorageCommandBase1 cmd,IRetryPolicy policy,OperationContext operationContext) e:\ projects \ azure-sdk-for-net \ microsoft-azure-api \ Services \ Storage \ Lib \ DotNetCommon \ Core \ Executor \ Executor.cs:line 737 at Microsoft.WindowsAzure.Storage.Table.TableBatchOperation.Execute(CloudTableClient 客户,字符串表名,TableRequestOptions requestOptions, 的OperationContext的OperationContext)在 E:\项目\ Azure的SDK换网\微软Azure的API \ SERVICES \ Storage \ Lib \ DotNetCommon \ Table \ TableBatchOperation.cs:行 85 at Microsoft.WindowsAzure.Storage.Table.CloudTable.ExecuteBatch(TableBatchOperation batch,TableRequestOptions requestOptions,OperationContext operationContext)in e:\ projects \ azure-sdk-for-net \ microsoft-azure-api \ Services \ Storage \ Lib \ DotNetCommon \ Table \ CloudTable.cs:line 165 at Library.Modules.Cloud.TableStorage.StorageTableRepository entities)
插入这些实体通常使用TableOperation
给我没有问题。
我无法在互联网上的任何地方或MSDN参考中找到此异常。
您可以检查批次1)中的所有实体是否具有相同的PartitionKey,并且2)实体在批次中不会重复多次。根据错误消息,查看批处理中的第7个实体。该实体造成问题。 –