【发布时间】:2023-03-20 05:48:01
【问题描述】:
我正在编写一个简单的 UWP 应用程序,其中用户将 InkCanvas 笔触信息发送到 Azure blockBlob,然后检索一些不同的 InkCanvas 笔触容器信息以呈现到画布。
我使用 StrokeContainer.saveAsync() 将 .ink 文件保存到 applicationData 本地文件夹到相同的位置和相同的文件名(它被每个事务替换),然后使用 CloudBlockBlob.uploadAsync() 上传它。
尝试从我的 Azure 服务器下载文件时出现问题 - 我收到“拒绝访问”错误。
async private void loadInkCanvas(string name)
{
//load ink canvas
//add strokes to the end of the name
storageInfo.blockBlob = storageInfo.container.GetBlockBlobReference(name + "_strokes");
//check to see if the strokes file exists
if (await storageInfo.blockBlob.ExistsAsync){
//then the stroke exists, we can load it in.
StorageFolder storageFolder = ApplicationData.Current.LocalFolder;
StorageFile storageFile = await storageFolder.CreateFileAsync("ink.ink", CreationCollisionOption.ReplaceExisting);
using (var outputStream = await storageFile.OpenAsync(FileAccessMode.ReadWrite))
{
await storageInfo.blockBlob.DownloadToFileAsync(storageFile);//gives me the "Access Denied" error here
}
}
}
任何帮助将不胜感激,我在网上发现的只是您不应该将直接路径放入目标位置,而是使用 ApplicationData.Current.LocalFolder 。
【问题讨论】: