OpenStack Rackspace Cloud Files .net SDK

被刻印的时光 ゝ 提交于 2019-12-08 02:51:05

问题


I am trying to save an XML file to a non CDN Container from Sydney:

public void Save(XDocument document)
{
    using (MemoryStream ms = new MemoryStream())
    {
        document.Save(ms);
        ms.Position = 0;

        RackspaceCloudIdentity identity = new RackspaceCloudIdentity { Username = "username", APIKey = "xxxxxxxxxxx", CloudInstance = CloudInstance.Default };
        CloudFilesProvider provider = new CloudFilesProvider(identity);

        provider.CreateObject("XMLFiles", ms, "xmlFile1.xml", region: "syd");
    }
}

For a 1MB file, it takes about 50 seconds to upload (very long).

And, trying to download the file back, returns an empty result:

public void Read()
{
    RackspaceCloudIdentity identity = new RackspaceCloudIdentity { Username = "username", APIKey = "xxxxxxxxxxx", CloudInstance = CloudInstance.Default };
    CloudFilesProvider provider = new CloudFilesProvider(identity);

    using (MemoryStream ms = new MemoryStream())
    {
        provider.GetObject("XMLFiles", "xmlFile1.xml", ms, region: "syd");

        // ms.Length is 0
    }
}

I am doing something wrong?


回答1:


Ugh. I introduced this bug in commit 799f37c (first released in v1.1.3.0). I'm looking into the best workaround right now.

Edit: There is no workaround, but I filed issue #116 for the issue, and after the pull request for it is merged, we'll release version 1.1.3.1 of the library to correct the problem.




回答2:


Are you able to access your control panel at mycloud.rackspace.com?

I used my control panel to upload an XML file, then used your code, above, to download the XML file. It worked fine.

I'm going now use the upload code you posted.

Just wanted you to know I'm looking into this.



来源:https://stackoverflow.com/questions/18254455/openstack-rackspace-cloud-files-net-sdk

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