无法从新的Silverlight应用程序访问独立存储



我有一个新的Silverlight应用程序,上面只有一个按钮,可以在本地很好地工作。我部署到我的暂存服务器,现在以下代码中断:

 public MainPage()
    {
      InitializeComponent();
      try
      {
        MessageBox.Show("Attempting to Access Isolated Storage");
        var store = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication();
        MessageBox.Show("Have Storage");
      }
      catch (Exception ex)
      {
        MessageBox.Show("1: Access Failed");
        MessageBox.Show(ex.Message);
        MessageBox.Show(ex.StackTrace);
      }
    }

我编写这个示例应用程序是为了了解我的实际应用程序中发生了什么。它也有同样的问题。直到几天前,我真正的应用程序已经运行了好几个星期。我无法确定有什么不同。

这是消息:

---------------------------
---------------------------
There is not enough free space to perform the operation.
---------------------------
OK   
---------------------------

这是堆栈跟踪:

---------------------------
---------------------------
   at System.IO.IsolatedStorage.IsolatedStorageFile.Reserve(UInt64 lReserve)
   at System.IO.IsolatedStorage.IsolatedStorageFile.FetchOrCreateStore(String groupName, String storeName, IsolatedStorageFile isf)
   at System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStore(String group, String id)
   at System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication()
   at SilverlightApplication1.MainPage..ctor()
---------------------------
OK   
---------------------------

谢谢。

我想你自己在帖子中给出了答案:"没有足够的可用空间来执行操作。"尝试增加IsolatedStorage:的大小

http://msdn.microsoft.com/en-us/library/system.io.isolatedstorage.isolatedstoragefile.increasequotato(v=vs.95).aspx

此外,您可能需要在使用后清理IsolatedStorage。也许这就是为什么你的应用程序工作了几天,然后突然坏了。我想IsolatedStorage只是"满了"。在代码末尾试试这个:

    var store = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication();
    //...do storage stuff
    store.Remove  //removes the storage

也许还可以在这里看到一些不错的IsolatedStorage示例:

http://msdn.microsoft.com/en-us/library/cc265154%28v=VS.95%29.aspx

希望我能帮助

相关内容

最新更新