【发布时间】:2012-05-25 06:05:34
【问题描述】:
我们的 .NET 4 应用程序尝试访问 Windows Server 2008 R2 机器上的独立存储 (GetMachineStoreForAssembly) 以获取新的“管理员”帐户时遇到了一个有趣的问题。同一台机器上的其他用户可以正常访问它。应用程序第一次在这个新帐户下运行并尝试访问独立存储时,它失败了:
System.IO.IsolatedStorage.IsolatedStorageException: Unable to create the store directory. (Exception from HRESULT: 0x80131468)
at System.IO.IsolatedStorage.IsolatedStorageFile.GetRootDir(IsolatedStorageScope scope, StringHandleOnStack retRootDir)
at System.IO.IsolatedStorage.IsolatedStorageFile.InitGlobalsMachine(IsolatedStorageScope scope)
at System.IO.IsolatedStorage.IsolatedStorageFile.GetRootDir(IsolatedStorageScope scope)
at System.IO.IsolatedStorage.IsolatedStorageFile.GetGlobalFileIOPerm(IsolatedStorageScope scope)
at System.IO.IsolatedStorage.IsolatedStorageFile.Init(IsolatedStorageScope scope)
at System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(IsolatedStorageScope scope, Type applicationEvidenceType)
我尝试通过 Windows 资源管理器浏览到 IsolatedStorage 文件,即 C:\ProgramData... 当我单击 ProgramData 时,系统会提示我:
You don't currently have permission to access this folder. Click Continue to permanently get access to this folder.
单击“继续”后,我们的应用程序就可以毫无问题地读取/写入 IsolatedStorage。
谁能解释这种行为?我们是否应该为新用户分配特定权限,以便他们可以访问独立存储?
谢谢!
【问题讨论】:
标签: c# .net windows-server-2008 windows-server-2008-r2 isolatedstorage