c# - 第一次访问缓存时出现 IsolatedStorage 异常

标签 c# windows-phone-7 isolatedstorage windows-phone-7.1

我遇到一个问题,每次我第一次运行应用程序时都会收到 IsolatedStorageException(“IsolatedFileStorageStream 上不允许的操作”)。随后运行该应用程序时,它工作得很好。我已经尝试了所有我能找到的打开文件进行写入的方法,包括

using (var iso = IsolatedStorageFile.GetUserStoreForApplication())
using (IsolatedStorageFileStream file = new IsolatedStorageFileStream(fileName, FileMode.Create, FileAccess.Write, iso))
{
}

using(var iso = IsolatedStorageFile.GetUserStoreForApplication())
using(IsolatedStorageFileStream file = iso.OpenFile(fileName, FileMode.OpenOrCreate))
{
}

以及这些方法的其他各种重载。我所做的一切都没有奏效,我已经按照 Stack Overflow 中所有其他帖子和我能找到的每篇博文中的步骤进行操作。当我查看输出时,每次都会抛出以下异常:

A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Net.WebException' occurred in System.Windows.dll
A first chance exception of type 'System.Net.WebException' occurred in System.Windows.dll
A first chance exception of type 'System.IO.DirectoryNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.IsolatedStorage.IsolatedStorageException' occurred in mscorlib.dll

有没有人对它爆炸的原因有任何其他想法?我正在使用 WP7 7.1 RTM 工具。

最佳答案

这是我学会了如何在 WP7 上写入隔离存储,

Using Isolated Storage on Windows Phone 7

希望对您有所帮助! :)

关于c# - 第一次访问缓存时出现 IsolatedStorage 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7640804/

相关文章:

c# - yield 返回和返回

c# - 无法打开物理文件操作系统错误 32

silverlight - Windows 手机 7 : Tombstoning with URIs?

c# - "RNGCryptoServiceProvider does not contain a definition for GetNonZeroBytes"

windows-phone-8 - 隔离存储 Windows 手机 8

c# - 当List <>在C#7.2中具有“in”参数修饰符时,为什么仍可以修改它?

c# - WCF 真的会取代.NET Remoting 吗?

windows-phone-7 - Windows Phone 的捏合和缩放行为

c# - 写入项目文件夹中的文件 - 不允许操作

c# - Windows Phone - 使用互斥锁进行独立存储