當試圖做一個批量插入到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個實體。該實體造成問題。 –