Khi cố gắng để làm một chèn hàng loạt để Azure Table Storage, Tôi nhận được một StorageException
trên CloudTable.ExecuteBatch()
:mã phản hồi không mong đợi từ CloudTable.ExecuteBatch (..)
TableBatchOperation batchOperation = new TableBatchOperation();
foreach (var entity in entities)
{
batchOperation.InsertOrReplace(entity);
}
table.ExecuteBatch(batchOperation);
ngoại lệ ném:
Microsoft.WindowsAzure.Storage.StorageException: Phản hồi không mong muốn mã hoạt động: 6 tại Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync [T] (StorageCommandBase1 cmd, chính sách IRetryPolicy, hoạt động OperationContextContext) trong e: \ projects \ azure-sdk-cho-net \ microsoft-azure-api \ Dịch vụ \ Storage \ Lib \ DotNetCommon \ Core \ Executor \ Executor.cs: dòng 737 lúc Microsoft.WindowsAzure.Storage.Table.TableBatchOperation.Execute (CloudTableClient khách hàng, String tableName, TableRequestOptions requestOptions, OperationContext operationContext) in e: \ projects \ azure-sdk-for-net \ microsoft-azure-api \ Services \ Lưu trữ \ Lib \ DotNetCommon \ Bảng \ TableBatchOperation.cs: dòng 85 tại Microsoft.WindowsAzure.Storage.Table.CloudTable.ExecuteBatch (TableBatchOperation batch, TableRequestOptions requestOptions, OperationContext operationContext) in e: \ projects \ azure-sdk-for-net \ microsoft-azure-api \ Dịch vụ \ Storage \ Lib \ DotNetCommon \ Table \ CloudTable.cs: dòng 165 tại Library.Modules.Cloud.TableStorage.StorageTableRepository đối tượng)
Chèn các thực thể này thông thường bằng cách sử dụng TableOperation
không mang lại sự cố nào.
Tôi không thể tìm thấy ngoại lệ này ở bất kỳ đâu trên internet hoặc trong tài liệu tham khảo MSDN.
Bạn có thể kiểm tra xem tất cả các thực thể trong lô 1) có cùng PartitionKey và 2) một thực thể không được lặp lại nhiều lần trong lô. Dựa trên thông báo lỗi, hãy nhìn vào thực thể thứ 7 trong lô của bạn. Thực thể đó đang gây ra vấn đề. –