0

我有这个小代码来读取表格存储中的所有条目。这是我的简单模型:

public class LineEntity : TableServiceEntity
{
    public XElement Data { get; set; }

    public LineEntity(string rowKey)
    {
        PartitionKey = "Line";
        RowKey = rowKey;
    }

    public LineEntity()
    {
    }
}

这是阅读它的代码:

var StorageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
var TableClient = StorageAccount.CreateCloudTableClient();
var ServiceContext = TableClient.GetDataServiceContext();
var models = ServiceContext.CreateQuery<LineEntity>("lines").ToList();

由于某种原因,最后一行将在云中引发以下异常:

<?xml version="1.0" encoding="utf-8"?><Error><Code>OutOfRangeInput</Code><Message>One of the request inputs is out of range.
RequestId:8a16121a-237c-4015-99cb-b1bbdb7ab7a7
Time:2012-04-30T07:39:42.6396851Z</Message></Error>

它在开发中工作得非常好。这个有什么线索吗?

谢谢,

4

1 回答 1

1

不应该这条线

var models = ServiceContext.CreateQuery<Line>("lines").ToList();

而是

var models = ServiceContext.CreateQuery<LineEntity>("lines").ToList();
于 2012-04-30T20:30:58.850 回答