The “Microsoft Azure Configuration Manager” library is not available for UWP apps. Suggestions?

断了今生、忘了曾经 提交于 2019-12-25 08:48:51

问题


The "Microsoft Azure Configuration Manager" library is not compatible with UAP apps and it seems that I need it to access the CloudConfigurationManager class for connecting to Azure Storage. It is used to parse the connection string:

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

Am I missing something here or is there maybe an alternative approach for getting connected for UWP app developers?

The guide I'm referring to: HERE


回答1:


As per January, there was no support for Azure Storage as a UWP client library. I could not find if there is any update on that, so i suppose you to use the REST API instead of client library (at least for now). Anyway, client library is just a wrapper around REST API. Also, i tried to find recently any ready-to-go up-to-date Azure Storage wrappers written by community, and looks like the simplest way is to write it by yourself than to try to find the ready solution (most of the solutions i have found were old).

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




回答2:


I don't believe you have to use CloudConfigurationManager.

You could connect to it manually:

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

Note: You will have to have WindowsAzure.Storage referenced but that is compatible with UWP. Its the configuration manager that is not.



来源:https://stackoverflow.com/questions/36947321/the-microsoft-azure-configuration-manager-library-is-not-available-for-uwp-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!