我有一个新的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
---------------------------
感谢。
答案 0 :(得分:0)
我猜你自己在帖子中给出了答案:"没有足够的可用空间来执行操作。"尝试增加IsolatedStorage的大小:
此外,您可能希望在使用后清理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
希望我能帮忙