C# 不允许对IsolatedStorageFileStream执行操作。隔离存储异常

C# 不允许对IsolatedStorageFileStream执行操作。隔离存储异常,c#,visual-studio-2013,silverlight-5.0,C#,Visual Studio 2013,Silverlight 5.0,我是C#和Visual Studio的初学者。我已经构建了一个Silverlight应用程序来获取播放器中的自定义参数,以便在浏览器外播放视频 在浏览器外运行应用程序的代码如下所示: // When running outside the browser, retrieve initParams from isolated storage. if (Application.Current.IsRunningOutOfBrowser) {

我是C#和Visual Studio的初学者。我已经构建了一个Silverlight应用程序来获取播放器中的自定义参数,以便在浏览器外播放视频

在浏览器外运行应用程序的代码如下所示:

        // When running outside the browser, retrieve initParams from isolated storage.
        if (Application.Current.IsRunningOutOfBrowser)
        {
            using (IsolatedStorageFile file =
                IsolatedStorageFile.GetUserStoreForApplication())

            using (var stream = new IsolatedStorageFileStream(
                "initParams.txt", System.IO.FileMode.Open, System.IO.FileAccess.Read, file))
            {
                // The serializer requires a reference to System.Runtime.Serialization.dll.
                DataContractSerializer serializer =
                    new DataContractSerializer(typeof(Dictionary<String, String>));
                initParams = (Dictionary<String, String>)serializer.ReadObject(stream);
            }
        }
        // Otherwise, save initParams to isolated storage.
        else
        {
            initParams = e.InitParams;

            using (IsolatedStorageFile file =
                IsolatedStorageFile.GetUserStoreForApplication())
            using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream(
                "initParams.txt", System.IO.FileMode.Create, file))
            {
                DataContractSerializer serializer =
                    new DataContractSerializer(typeof(Dictionary<string, string>));
                serializer.WriteObject(stream, initParams);
            }
        }
Visual Studio中的错误消息为

System.IO.IsolatedStorage.IsolatedStorage异常:操作不正常 在隔离存储文件流上允许。在 System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(字符串路径, FileMode模式、FileAccess访问、FileShare共享、Int32 bufferSize、, 隔离存储文件(isf)位于 System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(字符串路径, 文件模式、文件访问访问、隔离存储文件(isf) testplayer.App.LoadInitParams(StartupEventArgs e)位于 testplayer.App.Application\u启动(对象发送器、StartupEventArgs e) 在MS.Internal.CoreInvokeHandler.InvokeEventHandler(UInt32类型索引, 委托句柄委托、对象发送者、对象参数)位于 MS.Internal.joltelper.firevent(IntPtr unmanagedObj,IntPtr 非托管Jargs、Int32 argsTypeIndex、Int32 ActualGSTypeIndex、, 字符串eventName,UInt32标志)

有人能帮我解决这个问题吗

提前谢谢

            using (IsolatedStorageFile file =
                IsolatedStorageFile.GetUserStoreForApplication())

            using (var stream = new IsolatedStorageFileStream(
                "initParams.txt", System.IO.FileMode.Open, System.IO.FileAccess.Read, file))