【问题标题】:The "Microsoft Azure Configuration Manager" library is not available for UWP apps. Suggestions?“Microsoft Azure 配置管理器”库不适用于 UWP 应用。建议?
【发布时间】:2016-05-06 07:44:58
【问题描述】:

“Microsoft Azure 配置管理器”库与 UAP 应用程序不兼容,看来我需要它来访问 CloudConfigurationManager 类以连接到 Azure 存储。用于解析连接字符串:

// Parse the connection string and return a reference to the storage account.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
    CloudConfigurationManager.GetSetting("StorageConnectionString"));

我是否在这里遗漏了什么,或者是否有另一种方法可以让 UWP 应用开发人员建立联系?

我指的指南:HERE

【问题讨论】:

  • 我想你可以直接使用 HttpClient 调用 REST api。

标签: c# azure win-universal-app


【解决方案1】:

截至 1 月,不支持将 Azure 存储作为 UWP 客户端库。我找不到这方面是否有任何更新,所以我想你使用 REST API 而不是客户端库(至少现在是这样)。无论如何,客户端库只是 REST API 的包装器。另外,我最近试图找到由社区编写的任何随时可用的最新 Azure 存储包装器,看起来最简单的方法是自己编写而不是尝试找到现成的解决方案(大多数解决方案我发现是旧的)。

REST API reference Tutorial on how to use Azure Storage REST API

【讨论】:

    【解决方案2】:

    我认为您不必使用 CloudConfigurationManager。

    您可以手动连接到它:

    var credentials = new StorageCredentials("accountname", "accountkey");
    var account = new CloudStorageAccount(credentials, true);
    

    注意:您必须引用 WindowsAzure.Storage,但它与 UWP 兼容。它不是配置管理器。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-06
      • 2017-03-03
      • 1970-01-01
      • 2016-10-20
      • 2018-10-19
      • 1970-01-01
      • 1970-01-01
      • 2019-05-22
      相关资源
      最近更新 更多