【问题标题】:Getting Unable to determine application identity of the caller Error无法确定调用者错误的应用程序身份
【发布时间】:2016-10-11 16:13:51
【问题描述】:

我需要在 winforms 应用程序中以独立存储模式存储和检索数据。我关注了thismsdn 的文章,这是代码

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

当我执行上述代码时,我收到 无法确定调用者的应用程序身份错误。

谁能帮我解决这个问题?

问候

拉马林加姆

【问题讨论】:

标签: c# .net winforms


【解决方案1】:

在 WinForms 应用程序中,GetMachineStoreForApplication()IsolatedStorageScope.Application 不起作用。特定于应用程序的存储专为 ClickOnce 应用程序设计。

如果您想按用户存储设置,请改用GetMachineStoreForAssembly()IsolatedStorageScope.User

【讨论】:

    【解决方案2】:

    来自 MSDN 的许多隔离存储示例似乎不完整。

    你想调用这些而不是GetStore

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

    【讨论】:

      【解决方案3】:

      请使用这个:

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

      【讨论】:

      • 有趣的是,我使用了几乎相同的重载,但最后使用了单个 null 参数:IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly, null),它过去有效,但最近坏了(猜测原因是 Windows 更新) .您提供的重载,使用 2 个null 参数解决了问题。 :O
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-01-20
      • 2015-03-27
      • 2018-12-19
      • 2020-09-07
      • 1970-01-01
      • 1970-01-01
      • 2014-08-01
      相关资源
      最近更新 更多