无法使用模拟器 v4.0.0.0 将实体插入新 table
Can't insert entities into new table using emulator v4.0.0.0
我开始使用 Table 存储。我有模拟器 (v4.0.0.0) 工作并且可以通过代码成功创建 tables (我想我正在使用客户端库的 v2.6)。但我似乎无法插入实体。
根据这篇文章从 2010 年开始 (Azure Table Storage, what a pain in the ass),我需要在第一次使用 table 时插入一个虚拟实体(仅适用于模拟器)。
我还需要为存储模拟器 v4.0.0.0 执行此操作吗?文章中提供的代码还使用了已折旧的成员,因此我宁愿不使用它们。
Update - 我无法成功调用 results = table.ExecuteBatch(b);
,它在第一个实体上失败了,而 result = table.Execute(b[0]);
似乎可以正常工作。看来我需要做更多的挖掘。
更新 - 这是我通过异常得到的错误信息:
错误信息:"Unexpected response code for operation : 0"
- RequestInformation.HttpStatusCode: 400
- RequestInformation.ExtendedErrorInformation.ErrorCode: "InvalidInput"
- RequestInformation.ExtendedErrorInformation.ErrorMessage "0:请求输入之一无效。RequestId:6d740e0e-f013-4d29-a712-2942115e8e4d\nTime: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 list) in c:\...\AzureStorageDataProvider.cs:line 61”
正如我们的 Performing Entity Group Transactions 文章中所述,实体组交易(批次)不能包含超过 100 个实体。错误消息肯定应该更清楚,所以我将其作为错误归档,但将实体数量减少到 <=100 应该可以防止您看到的错误。
我开始使用 Table 存储。我有模拟器 (v4.0.0.0) 工作并且可以通过代码成功创建 tables (我想我正在使用客户端库的 v2.6)。但我似乎无法插入实体。
根据这篇文章从 2010 年开始 (Azure Table Storage, what a pain in the ass),我需要在第一次使用 table 时插入一个虚拟实体(仅适用于模拟器)。
我还需要为存储模拟器 v4.0.0.0 执行此操作吗?文章中提供的代码还使用了已折旧的成员,因此我宁愿不使用它们。
Update - 我无法成功调用 results = table.ExecuteBatch(b);
,它在第一个实体上失败了,而 result = table.Execute(b[0]);
似乎可以正常工作。看来我需要做更多的挖掘。
更新 - 这是我通过异常得到的错误信息:
错误信息:"Unexpected response code for operation : 0"
- RequestInformation.HttpStatusCode: 400
- RequestInformation.ExtendedErrorInformation.ErrorCode: "InvalidInput"
- RequestInformation.ExtendedErrorInformation.ErrorMessage "0:请求输入之一无效。RequestId:6d740e0e-f013-4d29-a712-2942115e8e4d\nTime: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 list) in c:\...\AzureStorageDataProvider.cs:line 61”
正如我们的 Performing Entity Group Transactions 文章中所述,实体组交易(批次)不能包含超过 100 个实体。错误消息肯定应该更清楚,所以我将其作为错误归档,但将实体数量减少到 <=100 应该可以防止您看到的错误。