我正在编写一个简单的UWP应用程序,其中用户将InkCanvas笔触信息发送到Azure blockBlob,然后检索一些不同的InkCanvas笔触容器信息以呈现到画布。UWP CloudBlob.DownloadFileAsync访问被拒绝错误
使用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。
请看看这里:http://www.damirscorner.com/blog/posts/20120419-ClosingStreamsInWinRt.html。 HTH。 –