无法使用模拟器v4.0.0.0将实体插入新表

时间:2015-06-29 03:37:12

标签: azure-table-storage azure-emulator

我开始使用Table Storage。我有模拟器(v4.0.0.0)工作,可以通过代码成功创建表(我想我正在使用客户端库的v2.6)。但我似乎无法插入实体。

根据这篇文章从2010年开始(Azure Table Storage, what a pain in the ass)我需要在第一次使用表时插入一个虚拟实体(仅适用于模拟器)。

我还需要为存储模拟器v4.0.0.0执行此操作吗?文章中提供的代码也使用已经折旧的成员,因此如果可能的话我宁愿不使用它们。

更新 - 我无法成功调用第一个实体失败的results = table.ExecuteBatch(b);,其中result = table.Execute(b[0]);似乎有效。看起来我需要做更多的挖掘。

更新 - 这是我通过例外获得的错误信息:

错误消息:“操作的意外响应代码:0”

  • RequestInformation.HttpStatusCode:400
  • RequestInformation.ExtendedErrorInformation.ErrorCode:“InvalidInput”
  • RequestInformation.ExtendedErrorInformation.ErrorMessage“0:其中一个请求输入无效.RequestId:6d740e0e-f013-4d29-a712-2942115e8e4d \ n时间:2015-06-29T20:28:05.5784120Z”
  • Stacktrace(剪切):“在Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync [T](RESTCommand 1 cmd, IRetryPolicy policy, OperationContext operationContext)\r\n at Microsoft.WindowsAzure.Storage.Table.TableBatchOperation.Execute(CloudTableClient client, CloudTable table, TableRequestOptions requestOptions, OperationContext operationContext)\r\n at Microsoft.WindowsAzure.Storage.Table.CloudTable.ExecuteBatch(TableBatchOperation batch, TableRequestOptions requestOptions, OperationContext operationContext)\r\n at Morphological.FinanceTracker.AzureDataProvider.AzureStorageDataProvider.SaveTransactionsToAzure(List 1列表)中c:\ ... \ AzureStorageDataProvider.cs:第61行“

1 个答案:

答案 0 :(得分:3)

正如我们的Performing Entity Group Transactions文章中所述,实体组事务(批处理)不能包含超过100个实体。错误消息肯定应该更清楚,因此我会将其作为错误提交,但将实体数量减少到< = 100应该可以防止您看到的错误。