如何在 Windows Phone 8.1 中实现 OpenStack Swift API

本文关键字:实现 OpenStack Swift API Windows Phone | 更新日期: 2023-09-27 18:35:45

我正在尝试在我的Windows Phone 8.1项目中添加openstack-SDK-DotNet引用,但它抛出了错误-无法安装软件包'OpenStack-SDK-DotNet 0.9.1'。您正在尝试将此包安装到面向"WindowsPhoneApp,版本=v8.1"的项目中

请帮助我如何在我的Windows Phone 8.1/Windows 8.1通用项目中添加openstack-SDK-DotNet引用。

如何在 Windows Phone 8.1 中实现 OpenStack Swift API

在以下步骤之后,我已经与Windows Phone 8.1建立了openstack swift连接:1. 将 newtonsoft.json 版本 - 6.0.2 添加到您的项目中。2. 然后添加 openstack-sdk-dotnot 引用。3. 添加这些参考后,请使用以下代码"Openstack swift dotnet api 仅支持最高 v2.0,因此请记住"

        try
        {
        var authUri = new Uri("http://localhost:5000/v2.0");
        var userName = "xxx";
        var password = "xxx";
       // var tenantId = "xxx..xxx";
        var tenantName = "xxx";
        var credential = new OpenStackCredential(authUri, userName, password, tenantName, "Region");
        var client = OpenStackClientFactory.CreateClient(credential);

            await client.Connect();
        }
        catch (Exception exception)
        {
            var ex = exception;
        }
        var storageServiceClient = client.CreateServiceClient<IStorageServiceClient>();
        var storageAccount = await storageServiceClient.GetStorageAccount();
        foreach (var container in storageAccount.Containers)
        {            
            Console.WriteLine(container.Name);
        }