问题
The scenario I am facing is that I have an ASP.NET web service (.NET 3.5) running on an W2k3 server which is using the CacheManager/IsolatedStorage store to store a persisted state variable. This configuration has been working fine for quite sometime until we changed the physical machine. Now whenver the code that accesses that value runs it throws an IsolatedStorageException (Posted below). As I understand it the user/assembly store is what is being accessed and the executing user is a member of the local administrators group. Does anyone have a suggestion as to what privilege is missing?
Error
Unable to create the store directory. (Exception from HRESULT: 0x80131468)
Stack Trace
Type: Microsoft.Practices.ObjectBuilder2.BuildFailedException. Error: The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.Caching.ICacheManager, Cache Manager]) failed: Unable to create the store directory. (Exception from HRESULT: 0x80131468) (Strategy type ConfiguredObjectStrategy, index 2). Trace: at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.Builder.BuildUp(IReadWriteLocator locator, ILifetimeContainer lifetime, IPolicyList policies, IStrategyChain strategies, Object buildKey, Object existing)
at Microsoft.Practices.ObjectBuilder2.Builder.BuildUp[TTypeToBuild](IReadWriteLocator locator, ILifetimeContainer lifetime, IPolicyList policies, IStrategyChain strategies, Object buildKey, Object existing)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp[T](IReadWriteLocator locator, ILifetimeContainer lifetimeContainer, IConfigurationSource configurationSource)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.LocatorNameTypeFactoryBase1.CreateDefault()
at Microsoft.Practices.EnterpriseLibrary.Caching.CacheFactory.GetCacheManager()
at Ept.Commands.SettlementCommand.BeginSettlement() in c:\Projects\EPT\Ept.Framework.Services\Commands\SettlementCommand.cs:line 102
at Ept.Commands.SettlementCommand.ExecuteKernel(SettlementRequest request) in c:\Projects\EPT\Ept.Framework.Services\Commands\SettlementCommand.cs:line 188
at Ept.Command
2.Execute(TRequest request) in c:\Projects\EPT\Ept.Framework.Services\Commands\Command.cs:line 79. ExecutingStrategyTypeName: ConfiguredObjectStrategy ExecutingStrategyIndex: 2 BuildKey: Build Key[Microsoft.Practices.EnterpriseLibrary.Caching.ICacheManager, Cache Manager] Type: System.IO.IsolatedStorage.IsolatedStorageException. Error: Unable to create the store directory. (Exception from HRESULT: 0x80131468). Trace: at System.IO.IsolatedStorage.IsolatedStorageFile.nGetRootDir(IsolatedStorageScope scope)
at System.IO.IsolatedStorage.IsolatedStorageFile.InitGlobalsNonRoamingUser(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 domainEvidenceType, Type assemblyEvidenceType)
at Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.IsolatedStorageBackingStore.Initialize()
at Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.IsolatedStorageBackingStore..ctor(String storageAreaName, IStorageEncryptionProvider encryptionProvider)
at Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.IsolatedStorageBackingStoreAssembler.Assemble(IBuilderContext context, CacheStorageData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.AssemblerBasedObjectFactory2.Create(IBuilderContext context, TConfiguration objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.AssemblerBasedCustomFactory
2.Create(IBuilderContext context, String name, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
at Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerAssembler.Assemble(IBuilderContext context, CacheManagerDataBase objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.AssemblerBasedObjectFactory2.Create(IBuilderContext context, TConfiguration objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
at Microsoft.Practices.EnterpriseLibrary.Caching.CacheManagerCustomFactory.Create(IBuilderContext context, CacheManagerDataBase objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.AssemblerBasedCustomFactory
2.Create(IBuilderContext context, String name, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.AssemblerBasedCustomFactory`2.CreateObject(IBuilderContext context, String name, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ConfiguredObjectStrategy.PreBuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context).
回答1:
The root cause of the issue is that the account which the web service was running under did not have a local user profile created thus the user assembly store didn't exist. The simple fix was just to logon to the box with the service account.
回答2:
If you are using Windows 2012 R2 and IIS 8.5, in the case your App is running on a specific Application Pool under its own identity, you need to check that the option "Load user Profile" in the Pool Advanced Parameters is set to True. By doing so, Windows will create a folder having App Pool Identity name under C:\Users and allow your app to write inside the local storage.
回答3:
I had this issue but creating "C:\Documents and Settings\Default User\Local Settings\Application Data\IsolatedStorage" did not resolve the problem because at some point there was a profile name change. The actual location for this server was "C:\Documents and Settings\Default User.WINDOWS\Local Settings\Application Data\IsolatedStorage".
If that does not work, I used Process Monitor with a filter for "IsolatedStorage" to find the correct path for the access denied error.
回答4:
On Windows 10 IIS Application Pool setting "Load User Profile" is True by default. But on Windows 2012 is False. Switching to True solved my issue.
来源:https://stackoverflow.com/questions/3242102/a-cause-for-hresult-0x80131468-when-accessing-isolatedstoragebackingstore