2014-10-30 31 views
1

enter image description here“文件名”已经损坏:Windows Phone的8.1 ​​

我从独立存储启动文件,当我调试的下一个代码,先前流被关闭,并得到此异常。

"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

哪行代码导致错误? – 2014-10-30 09:15:53

+0

@DecadeMoon感谢兄弟的回复,但现在我收到了新的错误。 “FILE_NAME”已损坏,无法打开“请帮助我,如何解决它? – 2014-10-30 09:22:05

+0

@DecadeMoon我正在尝试启动office文件和pdf文件。 – 2014-10-30 09:22:30

回答

0

1)确保如果您是从URI下载文件比你应该使用的,而不是HttpWebRequest的 2 WebClient的),请确保您的PaaS正确的URI

+0

我已经使用Background Downloader来完成它。我试图在完全下载之前启动它,因此它正在破坏。现在我解决了它。想看代码? @Deepak – 2014-11-20 05:39:05