Azure.Documents.Document-找不到方法

时间:2018-09-26 12:09:02

标签: azure-storage azure-cosmosdb azure-table-storage

我在以下代码下运行时遇到的错误

  

找不到方法:   'System.Threading.Tasks.Task 1<Microsoft.Azure.Documents.Client.ResourceResponse 1>   Microsoft.Azure.Documents.IDocumentClient.ReadDocumentAsync(System.String,   Microsoft.Azure.Documents.Client.RequestOptions)”。

在此之前,我可以使用

运行代码
  

Microsoft.WindowsAzure.Storage Microsoft.WindowsAzure.Storage.Table 尝试迁移到 Microsoft.Azure.CosmosDB.Table; Microsoft.Azure.Storage

这是我的代码,我相信与代码无关,但不确定如何解决此问题,并且我已将 Microsoft.Azure.Storage.Common 降级为9.0.0.1版-根据this

进行预览
public static async Task<CloudTable> CreateTableAsync(string tableName)
{
    CloudStorageAccount storageAccount = CreateStorageAccountFromConnectionString(CloudConfigurationManager.GetSetting("StorageConnectionString"));
    CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
    CloudTable table = tableClient.GetTableReference(tableName);
    try
    {
        await table.CreateIfNotExistsAsync();
    }
    catch (StorageException ex)
    {
        Console.WriteLine(ex.Message);
        throw;
    }

    Console.WriteLine();
    return table;
}

public static CloudStorageAccount CreateStorageAccountFromConnectionString(string storageConnectionString)
{
    CloudStorageAccount storageAccount;
    try
    {
        storageAccount = CloudStorageAccount.Parse(storageConnectionString);
    }
    catch (FormatException fex)
    {
        Console.WriteLine(fex);
        throw;
    }
    catch (ArgumentException aux)
    {
        throw;
    }

    return storageAccount;
}

感谢任何人可以提供建议。谢谢

0 个答案:

没有答案