[英]Azure Table Storage, ExecuteBatchAsync, Unexpected response code for operation : 0
By leveraging the Windows Azure SDK, I try to insert entities using CloudTable.ExecuteBatchAsync and TableBatchOperations. 通过利用Windows Azure SDK,我尝试使用CloudTable.ExecuteBatchAsync和TableBatchOperations插入实体。
The entity serialized as Json: 实体序列化为Json:
{
"LastAccessDate":"2015-02-27T00:00:00Z",
"Title":"Google open-sources HTTP/2-based RPC framework",
"PublicationDate":"0001-01-01T00:00:00",
"Id":"tag:theregister.co.uk,2005:story/2015/02/27/google_opensources_http2based_rpc_framework/",
"LastUpdatedDate":"2015-02-27T00:00:00Z",
"FeedUrl":"http://www.theregister.co.uk/software/developer/headlines.atom",
"Url":"http://go.theregister.com/feed/www.theregister.co.uk/2015/02/27/google_opensources_http2based_rpc_framework/",
"PartitionKey":"http%3a%2f%2fwww.theregister.co.uk%2fsoftware%2fdeveloper%2fheadlines.atom",
"RowKey":"http%3a%2f%2fgo.theregister.com%2ffeed%2fwww.theregister.co.uk%2f2015%2f02%2f27%2fgoogle_opensources_http2based_rpc_framework%2f",
"Timestamp":"0001-01-01T00:00:00+00:00",
"ETag":null
}
Represented by this POCO entity: 由该POCO实体代表:
public class SyndicationFeedArticle : TableEntity
{
public virtual DateTime LastAccessDate { get; set; }
public virtual string Title { get; set; }
public virtual DateTime PublicationDate { get; set; }
public virtual string Id { get; set; }
public virtual DateTime LastUpdatedDate { get; set; }
public virtual string FeedUrl { get; set; }
public virtual string Url { get; set; }
}
The problem arises when the entity is constructed from RSS xml processing. 从RSS xml处理构造实体时会出现问题。 ExecuteBatch of inserts throws
Unexpected response code for operation : 0
. 插入的ExecuteBatch抛出
Unexpected response code for operation : 0
。 I do understand that it means that the batch operation at index 0 failed. 我确实知道这意味着索引0的批处理操作失败。 Usually it's a problem with either Partition or Row keys being incorrect such as containing invalid characters (which is not the case above) or exceeding 1kb in size which in this case doesn't apply.
通常这是分区键或行键不正确的问题,例如包含无效字符(上述情况并非如此)或大小超过1kb,在这种情况下不适用。
Here's what puzzling me: 这是令我困惑的事情:
new()
creation and RSS business code) works well in a Unit test new()
创建和RSS商业代码)在单元测试中都可以正常工作 What I'm looking for are pointers on how I could troubleshoot this issue. 我正在寻找有关如何解决此问题的指针。 I've recreated various scenarios in unit tests and made sure my entities don't break constraints on keys but no luck.
我已经在单元测试中重新创建了各种场景,并确保我的实体不会破坏对键的约束,但是不会碰运气。 My main issue is why can't I get constant behaviours between the emulator and the cloud.
我的主要问题是为什么我不能在模拟器和云之间获得持续的行为。 This would really help me out or at least, it would point me toward another way to fix this problem.
这确实可以帮助我,或者至少可以为我指出解决该问题的另一种方法。
Thanks! 谢谢!
Ok, got it figured out. 好,知道了。 What happens in this particular scenario:
在这种特定情况下会发生什么:
PublicationDate
is instantiated using a DateTimeOffset.Date as source value which may be set at MinValue. 使用DateTimeOffset.Date作为可设置为MinValue的源值来实例化
PublicationDate
。 The table storage doesn't support MinValue for a DateTime column. 表存储不支持DateTime列的MinValue。
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <code>OutOfRangeInput</code> <message xml:lang="en-US">One of the request inputs is out of range. RequestId:9e74bf7a-0002-004e-1142-16dabb000000 Time:2015-02-28T02:01:42.2124803Z</message> </error>
I changed the entity property for a DateTime?
我将实体属性更改为
DateTime?
and manages this as a business rule. 并将其作为业务规则进行管理。 Of course, I'm left wondering why locally on the emulator this is supported...
当然,我想知道为什么在模拟器上本地支持此功能...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.