IsolatedStorageException: Unable to create the store directory

Discussion in 'ASP.NET / ASP.NET Core' started by deevallabh, Nov 9, 2009.

  1. I have a webservice that uses Isolated Storage functionality and its works fine when developed on my local box. When I deployed in to the server I get the following errors:

    System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.ComponentModel.LicenseException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: Protected storage could not be loaded! ---> System.IO.IsolatedStorage.IsolatedStorageException: Unable to create the store directory. (Exception from HRESULT: 0x80131468)
    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, Evidence domainEvidence, Type


    I have set the application to "fulltrust" in the web.config file and also said identity="true", but neither solution worked. Anyone have any idea where and what I access level I need to get this to run


    thanks
     
  2. Isolated storage is a Silverlight framework function so not intended to be used by web service code since that is server side code. If that's what your doing that will be why it's failing when deployed because the code will not have access to write to the the location where isolated storage lives on disk.

    It sounds like you need to be using Server.MapPath instead and writing to your own web server space?

    See http://msdn.microsoft.com/en-us/library/3ak841sy(VS.80).aspx for more info - you're application will never get access to the location where isolated storage resides on the DASP servers.
     
  3. Actually the library we use is a third party component used to validate licenses. They provided wrapper web service component around the dll to allow applications to connect to the web to retreive and validate software license information

    I email the support staff for the company and they suggested I create an account and configure the web.config <identity> tag to personate the user. When I did that I got an error saying the account does not have writes to the asp.net 2.0 temp directory.

    Any other ideas?
     
  4. Ok, but it's clear from your first post that it is a System.IO.IsolatedStorage.IsolatedStorageException that is being thrown by the System.IO.IsolatedStorage.IsolatedStorageFile class which means this is definitely related to the hosted application not having sufficient rights to access one of the paths in the file system on disk mentioned here http://msdn.microsoft.com/en-us/library/3ak841sy(VS.80).aspx

    I could be wrong (the DASP guys will know for sure) but I don't think you will ever get access to any of those locations because they are outside of your hosted file system area, regardless of what you attempt to do with impersonation or any other type of user credential manipulation. I think it's basically beyond the scope of what you can do in a shared hosting environment.

    For this to work, the hosted service should be attempting to use a resource that is accessible from your account e.g. perhaps an xml file on disk within your own account file system area or alternatively a database - MSAccess or SQL Server.
     
  5. I agree, I doubt I will be able to get the hosting company to change the permissions, I probably would have to get vps hosting which allows me full control.

    When I impersonated a user account the isloatedstorageexception no longer occured and received the error below which is expected in a server environment

    HttpException (0x80004005): The current identity (WEB705\xxx) does not have write access to 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files'.]
    System.Web.HttpRuntime.CheckAccessToTempDirectory() +8893247
    System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +153

    Did a little more digging and one could change the tempory directory per application in the compilation tag of the web.config and so I pointed it to a folder that the account does have permission to, but I ended up with isolatedstorageexception again

    Unfortunately the service is a third party tool and I do not have an access to the code, so I'm going to have figure out an alternate way to get this to work.

    Appreciate your help
     
  6. Bruce

    Bruce DiscountASP.NET Staff

    I don't think isolated storage will work unless your application is configured to use MachineStore rather than the userStore. THis is because the aspnet user doesn't have a profile and isolated storage is stored in the user profile.
     

Share This Page