Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 创建控制台应用程序以使用C从Azure表存储读取数据_C#_Azure_Azure Table Storage - Fatal编程技术网

C# 创建控制台应用程序以使用C从Azure表存储读取数据

C# 创建控制台应用程序以使用C从Azure表存储读取数据,c#,azure,azure-table-storage,C#,Azure,Azure Table Storage,请提供有关创建控制台应用程序以从Azure表存储读取数据的良好文档。我遵循并创建了一个示例控制台应用程序,如下所示。在运行控制台时,我看到“ReceivedBandRequest”错误: class Program { const string StorageAccountName = ""; const string StorageAccountKey = ""; static void Main(string[] args)

请提供有关创建控制台应用程序以从Azure表存储读取数据的良好文档。我遵循并创建了一个示例控制台应用程序,如下所示。在运行控制台时,我看到“ReceivedBandRequest”错误:

class Program
    {
        const string StorageAccountName = "";
        const string StorageAccountKey = "";

        static void Main(string[] args)
        {
            var storageAccount = new CloudStorageAccount(new StorageCredentials(StorageAccountName, StorageAccountKey), false);
            var tableaa = storageAccount.CreateCloudTableClient().GetTableReference("Table1");
            var result = tableaa.ExecuteAsync(TableOperation.Retrieve<Person>("<partition-key>", "<row-key>"));
            var entity = result.Result;
            Console.WriteLine(entity);
        }
    }

    class Person : TableEntity
    {
        private int customerID;
        private string LocationAreaCode;
        private string PersonnelSubAreaCode;
        private string PersonStatusCode;
        public void AssignRowKey()
        {
            this.RowKey = customerID.ToString();
        }
        public void AssignPartitionKey()
        {
            this.PartitionKey = "<partition-key";
        }    
    }

Person类中缺少无参数构造函数:

请按以下方式更改人员类别:

class Person : TableEntity
{
    private int customerID;
    private string LocationAreaCode;
    private string PersonnelSubAreaCode;
    private string PersonStatusCode;

    public Person()
    {

    }

    //other code


}

有关更多详细信息,请参阅此。

您正在使用的分区键和行键的值是多少?请查看此文档:这有帮助吗?@GauravMantri AIS分区键的值是PersonnelNumber。RowKey是自动生成的随机guid值。我建议通过Fiddler跟踪您的请求/响应。这将为您提供更多有关错误的信息。这肯定是个问题,但我高度怀疑它是否会导致BadRequest错误。@GauravMantri AIS,感谢您指出这一点。让我们通过添加这个来等待op的反馈,看看他是否需要进一步的帮助。我正在寻找Azure表存储?@user3693060,Azure Cosmos DB Table API绝对可以用于Azure表存储,建议:。我正在寻找从存储帐户中的表读取数据。你能分享一些与此相关的文件吗?非常感谢。