C# IsolatedStorageFile异常

C# IsolatedStorageFile异常,c#,exception,isolatedstorage,C#,Exception,Isolatedstorage,我尝试使用以下代码创建IsolatedStorageFile: IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication(); 但我有以下例外: IsolatedStoredException "Unable to determine application identity of the caller." 出现这种情况的可能原因是什么?如果您在调试时看到这种情况,可以通过转到项目属性中的“安全”选项卡

我尝试使用以下代码创建
IsolatedStorageFile

IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();
但我有以下例外:

IsolatedStoredException 
"Unable to determine application identity of the caller."

出现这种情况的可能原因是什么?

如果您在调试时看到这种情况,可以通过转到项目属性中的“安全”选项卡启用ClickOnce安全设置来解决。这将模拟调试时具有应用程序标识所需的清单

请注意,Visual Studio(至少2012 Update 4)中存在一个明显的错误,即使启用了安全设置,它仍会抛出此错误。如果发生这种情况,请关闭项目并删除.csproj.user文件,然后重新打开项目