【发布时间】:2015-12-03 09:53:00
【问题描述】:
我正在使用OpenStack SDK .NET 开发云备份客户端。在我的previous question 中,我遇到了身份识别问题,并且完美解决了。现在我几乎测试了我需要的所有功能,但有一件事似乎无法正常工作。 我需要在对象存储 swift 中创建对象版本控制功能。我在 Openstack 官方文档中读到我需要在 Rest 中添加一个标头:
X-Versions-Location: myversionlocation
在我的库中,我修改了创建容器的方法:
public void CreateContainer(string _containerName)
{
filesProvider.CreateContainer(_containerName, null, null, false, null);
}
到:
public void CreateContainer(string _containerName)
{
Dictionary<string, string> versioningHeader = new Dictionary<string, string>();
versioningHeader.Add("X-Versions-Location", "versions");
filesProvider.CreateContainer(_containerName, versioningHeader, null, false, null);
}
在容器中上传文件时没有问题,但是当我第二次上传时,我的应用程序在此行中抛出了 ResponseException: {"Unexpected HTTP error: PreconditionFailed"}:
public void UploadFile(string _containerName, string _fileName, ThrottledStream _stream)
{
filesProvider.CreateObject(_containerName, _stream, _fileName, null, 4096, null, "RegionOne");
}
这是创建启用版本控制的容器的正确方法吗?
【问题讨论】:
标签: c# .net cloud storage openstack