Unexpected response code from CloudTable.ExecuteBatch (..)

When I try to do a batch insert in Azure Table Storage, I get a StorageException on CloudTable.ExecuteBatch() :

 TableBatchOperation batchOperation = new TableBatchOperation(); foreach (var entity in entities) { batchOperation.InsertOrReplace(entity); } table.ExecuteBatch(batchOperation); 

An exception:

Microsoft.WindowsAzure.Storage.StorageException: unexpected response code for operation: 6 on Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync [T] (StorageCommandBase1 cmd, IRetryPolicy policy, OperationContext operationContext) in e: \ Projects \ azure- KFOR for intranet \ Microsoft-Azure-Api \ Services \ Storage \ Lib \ DotNetCommon \ Kernel \ Artist \ Executor.cs: line 737 on Microsoft.WindowsAzure.Storage.Table.TableBatchOperation.Execute (CloudTableClient client, String tableName, RequestRequestOptions requestOptions , OperationContext operationContext) in e: \ Projects \ Azure-KFOR for intranet \ Microsoft-Azure-Api \ Services \ Storage \ Lib \ DotNetCommon \ Table \ TableBatchOperation.cs: line 85 on Microsoft.WindowsAzure.Storage.Table.CloudTable. ExecuteBatch (TableBatchOperation package, querying table query queries Owls operatsiyaKontekst operationContext) in e: \ Projects \ blue-KFOR to the intranet \ Microsoft-blue-Api \ Services \ Storage \ Lib \ DotNetCommon \ Table \ CloudTable.cs: line 165 in Library.Modules.Cloud.TableStorage.StorageTableRepository 1.InsertOrReplaceBatch(List 1 entities)

Inserting these objects, usually using TableOperation , does not pose a problem.

I cannot find this exception anywhere on the Internet or in MSDN links.

+7
c # azure azure-storage azure-table-storage
source share
1 answer

This was due to duplicate RowKey values. Even with TableBatchOperation.InsertOrReplace(entities) row keys must still be unique.

Unexpected response code for operation : 6 meant the 6th element in the list. The error codes in the Azure SDK are very erroneous, in my opinion.

+14
source share

All Articles