【发布时间】:2018-09-22 11:02:35
【问题描述】:
我正在使用 Azure 存储来记录我的机器人和用户之间的对话。我想将用户发送的附件存储在 Azure Blob 容器中。我以这种方式使用 ContentUrl 属性:
foreach (Attachment item in message.Attachments)
{
/// creo una sottodirectory in cui verranno salvate tutte le immagini con quel conversation Id, quindi di quella conversazione
CloudBlockBlob targetBlob = _alturasbotChatAttachmentBlobsContainer.GetBlockBlobReference("conv#" + message.Conversation.Id.ToLower() + "/" + item.Name);
/// carico il file dall'url datomi dall'utente
try
{
await targetBlob.StartCopyAsync(new Uri(item.ContentUrl));
}
catch (Exception e)
{
throw;
}
}
问题是,如果 url 不是绝对的,则在 try-catch 中会引发异常(例如,如果我从 google 插入图像 url 而不是 contentUrl,则一切正常)。也许 ContentUrl 不能以这种方式使用,因为它是本地地址。有没有办法解决问题?我是否必须使用 Content 属性(如果是,如何使用?)。 谢谢
【问题讨论】:
标签: c# azure azure-storage botframework azure-blob-storage