2011-12-07 57 views
3

我需要在Winforms應用程序中以隔離存儲模式存儲和檢索數據。我按照this MSDN文章,這是代碼無法確定調用者的應用程序身份錯誤

IsolatedStorageFile isoStore = IsolatedStorageFile.GetStore(IsolatedStorageScope.Machine | IsolatedStorageScope.Application,null,null); 

當我exceute上面的代碼我得到無法確定呼叫者錯誤的應用程序標識。

任何人都可以幫我解決這個問題嗎?

問候

Ramalingam小號

+0

http://stackoverflow.com/questions/7294461/unable-to-determine-application-identity-of-the-caller – Waqas

+5

可能的重複不是該問題的重複,因爲這是WinForms(另一個是Silverlight )和原因是不同的。 –

回答

3

從MSDN許多例子,用於隔離存儲出現不完整的。

你想,而不是調用GetStore這些:

  • GetMachineStoreForApplication()
  • GetMachineStoreForAssembly()
  • GetMachineStoreForDomain()
2

請使用:

IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly, null, null) 
3

在WinForms應用程序中,GetMachineStoreForApplication()IsolatedStorageScope.Application不起作用。應用程序特定存儲僅適用於ClickOnce應用程序。

如果要以每個用戶爲基礎存儲設置,請改爲使用GetMachineStoreForAssembly()IsolatedStorageScope.User

相關問題