Dav*_*New 9 c# azure azure-storage azure-table-storage
当试图做一个批量插入到Azure的表存储,我得到一个StorageException
上CloudTable.ExecuteBatch()
:
TableBatchOperation batchOperation = new TableBatchOperation();
foreach (var entity in entities)
{
batchOperation.InsertOrReplace(entity);
}
table.ExecuteBatch(batchOperation);
Run Code Online (Sandbox Code Playgroud)
抛出异常:
Microsoft.WindowsAzure.Storage.StorageException:操作的意外响应代码:6位于e:\ projects\azure-中的Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync [T](StorageCommandBase1 cmd,IRetryPolicy策略,OperationContext operationContext) sdk-for-net\microsoft-azure-api\Services\Storage\Lib\DotNetCommon\Core\Executor\Executor.cs:Microsoft.WindowsAzure.Storage.Table.TableBatchOperation.Execute的第737行(CloudTableClient客户端,String tableName,TableRequestOptions requestOptions,OperationContext operationContext)在e:\ projects\azure -sdk-for-net\microsoft-azure-api\Services\Storage\Lib\DotNetCommon\Table\TableBatchOperation.cs:Microsoft.WindowsAzure.Storage.Table第85行.在e:\ projects\azure-sdk-for-net\microsoft-azure-api\Services\Storage\Lib\DotNetCommon\Table\CloudTable.cs:第165行中的CloudTable.ExecuteBatch(TableBatchOperation批处理,TableRequestOptions requestOptions,OperationContext operationContext) Library.Modules.Cloud.TableStorage.StorageTabl eRepository
1.InsertOrReplaceBatch(List
1实体)
通常使用插入这些实体TableOperation
不会给我带来任何问题.
我无法在互联网或MSDN参考中的任何地方找到此异常.
Dav*_*New 15
这是由于重复的RowKey
值.即使使用TableBatchOperation.InsertOrReplace(entities)
,行键仍然需要是唯一的.
Unexpected response code for operation : 6
是指列表中的第6个元素.在我看来,Azure SDK中的错误代码非常具有误导性.
归档时间: |
|
查看次数: |
6331 次 |
最近记录: |