- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已将视频文件保存在 IsolatedStorage 中,并使用 Windows Phone 8 中的 Media Element 播放它。这是第一次,它执行得非常好并成功运行,我能够播放视频,
问题是,每当我第二次玩的时候,都会出现这样的错误:
"Operation not permitted on IsolatedStorageFileStream"
查看我的代码:
string mediafile = "asaqwrereertrtyrzxxcvcvvbvbv+qwwezzxzxz";
byte[] PlayByte = Convert.FromBase64String(mediafile);
MemoryStream stream = new MemoryStream(PlayByte, 0, PlayByte.Length);
IsolatedStorageFileStream isfStream = new IsolatedStorageFileStream(audioName, FileMode.OpenOrCreate,FileAccess.ReadWrite, IsolatedStorageFile.GetUserStoreForApplication());
isfStream.Write(stream.ToArray(), 0, stream.ToArray().Length);
isfStream.Close();
Uri uri = new Uri(isfStream.Name.ToString());
MediaElement1.Source = uri;
MediaElement1.Play();
最佳答案
应该通过处理该流来解决意味着当音频停止播放时通过 isfStream.Dispose();
处理流所以它不会抛出异常但问题仍然存在您可以尝试给出的解决方案下面:
当您多次同时执行该代码块时,通常会发生这种情况。您最终锁定了文件。因此,您必须确保在构造函数中包含 FileAccess
和 FileShare
模式,如下所示:
using(var isfStream = new IsolatedStorageFileStream(audioName, FileMode.OpenOrCreate,FileAccess.ReadWrite, IsolatedStorageFile.GetUserStoreForApplication())
{
//...
}
关于c# - Windows Phone 中的 "Operation not permitted on IsolatedStorageFileStream"问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24076997/
当我尝试将文件内容保存在 fileStream fs 中时,出现 operation not permitted on IsolatedStorageFileStream 错误。 var appSto
创建后打开文件时出现错误 using (var myFileStore = IsolatedStorageFile.GetUserStoreForApplication()) {
我见过很多类似的问题,我真的尝试了所有的解决方案,但似乎没有一个对我有用。 这是我现在拥有的: private readonly object _lock = new object()
我对隔离存储有疑问。 这是我的代码: List data = new List(); using (IsolatedStorageFile isoStore = IsolatedSt
“在 IsolatedStorageFileStream 上不允许操作。”指向代码行: var fileStream = storage.OpenFile(item.FileName, FileMod
我正在尝试使用以下代码在隔离存储中创建一个文件, IsolatedStorageFile storageFile = IsolatedStorageFile.GetUserStoreForApplic
我在以下代码中遇到上述异常和错误,这意味着从独立存储中播放选定的 mp3 文件: using (var isf = IsolatedStorageFile.GetUserStoreForApplica
我正在尝试获取使用 isolatedStoragesettings 保存的 bool 值,如下所示: IsolatedStorageSettings.ApplicationSettings.TryGe
我有一个继承自 IsolatedStorageFileStream 的名为 XorIsoStoreFileStream 的类,关键是使用这个类,东西是用异或“加密”编写的,当它对它进行异或时,也可以使
我正在尝试从 IsolatedStorage 读取文本文件并检查它是否包含字符串。如果不是,则将该字符串添加到文件末尾。但是当我尝试将字符串写入文件时,出现错误:“IsolatedStorageFil
我已将视频文件保存在 IsolatedStorage 中,并使用 Windows Phone 8 中的 Media Element 播放它。这是第一次,它执行得非常好并成功运行,我能够播放视频, 问题
问题很明确:我正在尝试将“System.IO.IsolatedStorage.IsolatedStorageFileStream”转换为 ImageSource,但不知道如何执行此操作。我看过几篇关于
怎么了?我在此行中收到此错误“在隔离存储文件流上不允许操作”: using (IsolatedStorageFileStream fileStream = myIsolatedStorage.Open
Windows Phone 7 应用该应用程序的目标是一个简单的待办事项列表。我有一个“toditem”类,我将这些对象添加到 Items 对象中。 在我看来,我正在做一些非常复杂的事情,很可能没有干
我将文档 (.doc) 存储在我的应用程序的 IsolatedStorage 中。我需要在 Office 应用程序中打开该文档。 经过很长时间的搜索,我编写了如下代码。但它显示错误。我需要知道如何将
我是一名优秀的程序员,十分优秀!