简体   繁体   English

WP7异常错误-在IsolatedStorageFileStream上不允许进行操作

[英]WP7 Exception error - Operation not permitted on IsolatedStorageFileStream

How do I solve the exception, Operation not permitted on IsolatedFileStream? 如何解决例外情况,不允许对IsolatedFileStream进行操作?

After debugging, I realised that a certain line wasn't read and it was skipped to the catch part. 调试后,我意识到未读取特定的行,因此将其跳过到catch部分。 I am reading images from the photo samples in windows phone 7 as well as uploading them into skydrive. 我正在从Windows Phone 7的照片样本中读取图像,并将它们上传到skydrive中。 Can anybody guide me on how to solve this problem asap? 谁能尽快指导我解决这个问题? Thanks. 谢谢。

public BitmapImage fileName { get; set; }

private void GetImages()
{
    MediaLibrary mediaLibrary = new MediaLibrary();
    var pictures = mediaLibrary.Pictures;

    foreach (var picture in pictures)
    {
        BitmapImage image = new BitmapImage();
        image.SetSource(picture.GetImage());              

        MediaImage mediaImage = new MediaImage();
        mediaImage.fileName = image;
        UploadFile(mediaImage, picture.Name);                
    }
}

public void UploadFile(MediaImage image, string filepath)
{
   if (skyDriveFolderID != string.Empty) 
   {
     this.client.UploadCompleted += new EventHandler<LiveOperationCompletedEventArgs>(ISFile_UploadCompleted);
     infoTextBlock.Text = "Uploading backup...";
     dateTextBlock.Text = "";

     try
     {
        using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
        {
           // error occurs HERE
           IsolatedStorageFileStream readStream = myIsolatedStorage.OpenFile(filepath, FileMode.Open, FileAccess.Read);

           readStream.Close();
           this.client.UploadAsync(skyDriveFolderID, filepath, true, readStream, null)
        }
     }        

Are you sure error occurs there? 您确定那里发生错误吗? I can se you are closing the stream before reading it. 我可以确定您在阅读之前关闭了流。 So it may be that you got the line of error wrong. 因此,可能是您错了错误线。

Also, are you absolutely sure, that file with that exact name exists in Isolated Storage? 另外,您绝对确定隔离存储中存在具有相同名称的文件吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 WP7 IsolatedStorageFileStream错误“ IsolatedStorageFileStream上不允许进行操作” - WP7 IsolatedStorageFileStream Error “Operation not permitted on IsolatedStorageFileStream” WP7中对IsolatedStorageFileStream不允许的操作 - Operation not permitted on IsolatedStorageFileStream in WP7 WP7 IsolatedStorage异常:{“ IsolatedStorageFileStream上不允许操作。”} - WP7 IsolatedStorage Exception: {“Operation not permitted on IsolatedStorageFileStream.”} 不允许在IsolatedStorageFileStream上进行操作-WP7 C# - Operation not permitted on IsolatedStorageFileStream - WP7 C# IsolatedStorageFileStream异常上不允许执行操作 - Operation not permitted on IsolatedStorageFileStream Exception 在IsolatedStorageFileStream错误上不允许操作 - Operation not permitted on IsolatedStorageFileStream error wp8不允许对IsolatedStorageFileStream进行操作 - wp8 Operation not permitted on IsolatedStorageFileStream WP8中的IsolatedStorageFileStream上不允许操作 - Operation not permitted on IsolatedStorageFileStream in WP8 IsolatedStorageFileStream上不允许操作。 错误 - Operation not permitted on IsolatedStorageFileStream. error 获得“在独立存储文件流上不允许操作”。 错误 - Getting “Operation not permitted on IsolatedStorageFileStream.” Error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM