Azure Blob 存储 StartCopy,源指向 Cloud Convert

标签 azure azure-storage azure-blob-storage internal-server-error

我使用 Cloud Convert 转换视频,完成后,我告诉 Azure BLOB 存储使用 CloudBlockBlob.StartCopyAsync 方法从转换输出 URL 下载文件>.

我必须说,这曾经有效。在这个过程开始失败之前,我没有更改任何一行代码。

现在,每当 Azure 尝试从 Cloud Convert 下载时,都会失败并显示消息 500 InternalServerError“复制失败。”。如果我在浏览器中复制下载 URL,它会正常下载文件。该过程适用于存储模拟器。

我的问题是,其他人也有同样的问题吗?我该如何解决?我是否需要自己下载该文件并将其上传到 Azure Blob 存储?

最佳答案

But once I check the CopyState it says it failed with the message InternalServerError "Copy failed."

在我这边测试时,没有遇到这个错误。请尝试调试您的代码并捕获详细的错误,看看该错误是在您的代码中还是在服务器端抛出。

I must say, this used to work. I haven't changed a single line of code until this process started to fail.

根据您的描述,我在 Cloud Convert 中注册了一个帐户,并将 .pdf 文件转换为 .docx 文件。然后我在我这边进行了测试,得到了与 Gaurav 所说的相同的结果,可以成功创建 blob,但是 blob 的大小为 0 字节。我认为 Cloud Convert 可能会做出一些调整。由于您可以在浏览器中下载该文件,因此您可以按照以下代码作为替代方法来实现您的目的。

//pdf-to-docx.docx
url = "https://host123d1qm.cloudconvert.com/download/~7-9EyBedLQQyCoh41ONW6h1RpFY";
using (HttpClient client = new HttpClient())
{   
    //download the file via the URL provided by CloudConvert
    var response = await client.GetAsync(url);
    //define the block blob object
    string filename = response.Content.Headers.ContentDisposition.FileName.Trim(new char[] { '"' });
    string contentType = response.Content.Headers.ContentType.ToString();
    CloudBlockBlob blockBlob = container.GetBlockBlobReference(filename);
    blockBlob.Properties.ContentType = contentType;
    //upload blob
    await blockBlob.UploadFromStreamAsync(await response.Content.ReadAsStreamAsync());
}

关于Azure Blob 存储 StartCopy,源指向 Cloud Convert,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39394189/

相关文章:

python - 如何在不使用 Flask 的情况下将 Python Telegram Bot 部署到 Azure?

Azure Node.js 函数用于更新/检索 Azure 表存储中的实体

Azure Synapse 无服务器删除由 CREATE EXTERNAL TABLE AS SELECT 语句创建的文件

azure - Azure 事件中心消息存储在哪里?

c# - 如何从 Azure 函数中获取多个 blob?

azure - Xamarin 文本 blob Azure 存储

azure - 创建脚本以对域和网站证书进行监控

azure - 将函数部署到 Azure 后出现错误 : 'Could not load file or assembly ' System. ServiceModel,版本=4.0.0.0'

azure - 使用 fiddler/postman 进行 Azure 表存储 REST API

Azure 存储帐户 - 只读组