我正在尝试将 XML 文件保存到悉尼的非 CDN 容器:
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");
}
}
对于 1MB 的文件,上传大约需要 50 秒(非常长)。
并且,尝试下载回文件,返回空结果:
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
}
}
我做错了什么吗?
最佳答案
呃。我在提交 799f37c
中引入了这个错误(首次发布于 v1.1.3.0)。我现在正在寻找最好的解决方法。
编辑:没有解决方法,但我提交了 issue #116对于这个问题,以及pull request之后由于已合并,我们将发布该库的 1.1.3.1 版本来纠正问题。
关于OpenStack Rackspace 云文件 .net SDK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18254455/