“文件名”已损坏:Windows Phone 8.1

时间:2014-10-30 05:00:52

标签: c# windows-phone-8.1 isolatedstorage launcher

enter image description here

我从隔离存储启动文档,当我调试下一个代码时,前一个流被关闭并获得此异常。

"File-Name" has been damaged and can't be opened.

请参阅下面的代码:

 using (IsolatedStorageFile storageFile = IsolatedStorageFile.GetUserStoreForApplication())
 {
     using (stream = storageFile.OpenFile("Document.docx", FileMode.Create))
     {
        await stream.WriteAsync(buffer, 0, buffer.Length);
     }               
 }

StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
StorageFile pdffile = await local.GetFileAsync("Document.docx");

await Windows.System.Launcher.LaunchFileAsync(pdffile);

1 个答案:

答案 0 :(得分:0)

1)确定如果你从URI下载文件比你应该使用WebClient而不是HttpWebRequest 2)确保你输入正确的URI