IsolatedStorageException: Unable to create the store directory. (Exception from HRESULT: 0x80131468)

4

I've hit an interesting problem with our .NET 4 application trying to access IsolatedStorage (GetMachineStoreForAssembly) on a Windows Server 2008 R2 machine for a new "administrator" account. Other users on this same machine can access it just fine. The first time the application is run under this new account and tries to access IsolatedStorage, it fails:

    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)

I attempted to browse to the IsolatedStorage file via Windows Explorer, i.e. C:\ProgramData... As soon as I clicked on ProgramData, I was presented with a prompt:

You don't currently have permission to access this folder. Click Continue to permanently get access to this folder.

As soon as I clicked Continue, our application could read/write to IsolatedStorage with no problem.

Can anyone explain this behavior? Is there a specific permission we should be assigning to our new users so that they can access IsolatedStorage?

Thanks!

c#
.net
windows-server-2008
windows-server-2008-r2
isolatedstorage
asked on Stack Overflow May 17, 2012 by John Russell

1 Answer

0

I faced the same behavior when I reinstalled new Windows OS above the previous one. If you have the same issue I believe if you will check the folder's permissions (RMB click and then the 'Properties' menu) you will find unknown user's SID (something like S-1-5-21-3626571138-2175758104-1447827851-1013). But this unknown user is a creator and owner of this folder, so you have to replace the owner with yourself. So I guess this question is about NTFS rather than .NET, although I'm sure Microsoft still has very poor implementation of directory browsing methods/dialogs.

Anyway you can replace orphaned SID with existing one with setacl:

setacl.exe -on C:\ 
           -ot file 
           -actn trustee -trst "n1:S-**old**-XXX;n2:S-**new**-XXX;ta:repltrst" 
           -rec cont
answered on Stack Overflow Mar 21, 2014 by heq

User contributions licensed under CC BY-SA 3.0