0

I m using RackSpace to upload email attachments. This is how I m trying to upload it to RackSpace Cloud:

//Skipped Authentication Setup
string containerName = ConfigurationManager.AppSettings["ContainerName"];

using (var stream = new MemoryStream())
{
    StreamWriter memoryWriter = new StreamWriter(stream);
    memoryWriter.Write(file);
    stream.Position = 0;
    stream.Seek(0, 0);
    cloudFilesProvider.CreateObject(containerName, stream, fileName);
}

var header = cloudFilesProvider.GetContainerCDNHeader(containerName, "ORD");
string Url = header.CDNSslUri + "/" + fileName;

This code uploads file of size 0 into Cloud and on reaching to header variable, it throws error:

The item was not found or does not exist

Any help would be appreciated.

4

1 回答 1

1

您能否验证您的容器是否启用了 CDN?如果不是,当您 HEAD 容器的 CDN 管理 URL 时,它将返回 HTTP 404。我怀疑这是正在发生的事情。

我不确定您使用的是哪些库,但您可以在此处找到有关如何启用 CDN 容器的信息:

https://developer.rackspace.com/docs/cloud-files/v1/developer-guide/#cdn-enabling-the-container-and-setting-a-ttl

于 2016-05-03T15:21:21.670 回答