2011-12-07 29 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

相关问题