none
System.IO.IsolatedStorage.IsolatedStorageException: Unable to create the store directory.

    Question

  • I am using OpenXML to create spreadsheets on a web server and display them in the users browser window. All of a sudden, I am getting the following error in production. I have no idea what caused this error to occur or what the solution is. Please help.

    Supporting Info
    System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> 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.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 MS.Internal.IO.Packaging.PackagingUtilities.ReliableIsolatedStorageFileFolder.GetCurrentStore()
    at MS.Internal.IO.Packaging.PackagingUtilities.ReliableIsolatedStorageFileFolder..ctor()
    at MS.Internal.IO.Packaging.PackagingUtilities.GetDefaultIsolatedStorageFile()
    at MS.Internal.IO.Packaging.PackagingUtilities.CreateUserScopedIsolatedStorageFileStreamWithRandomName(Int32 retryCount, String& fileName)
    at MS.Internal.IO.Packaging.SparseMemoryStream.SwitchModeIfNecessary()
    at MS.Internal.IO.Packaging.SparseMemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)
    at MS.Internal.IO.Packaging.CompressEmulationStream.Write(Byte[] buffer, Int32 offset, Int32 count)
    at MS.Internal.IO.Packaging.CompressStream.Write(Byte[] buffer, Int32 offset, Int32 count)
    at MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Write(Byte[] buffer, Int32 offset, Int32 count)
    at MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Write(Byte[] buffer, Int32 offset, Int32 count)
    at System.Xml.XmlUtf8RawTextWriter.FlushBuffer()
    at System.Xml.XmlUtf8RawTextWriter.WriteAttributeTextBlock(Char* pSrc, Char* pSrcEnd)
    at System.Xml.XmlUtf8RawTextWriter.WriteString(String text)
    at System.Xml.XmlWellFormedWriter.WriteString(String text)
    at DocumentFormat.OpenXml.OpenXmlElement.WriteAttributesTo(XmlWriter xmlWriter)
    at DocumentFormat.OpenXml.OpenXmlElement.WriteTo(XmlWriter xmlWriter)
    at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo(XmlWriter w)
    at DocumentFormat.OpenXml.OpenXmlElement.WriteTo(XmlWriter xmlWriter)
    at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo(XmlWriter w)
    at DocumentFormat.OpenXml.OpenXmlElement.WriteTo(XmlWriter xmlWriter)
    at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo(XmlWriter w)
    at DocumentFormat.OpenXml.OpenXmlPartRootElement.WriteTo(XmlWriter xmlWriter)
    at DocumentFormat.OpenXml.OpenXmlPartRootElement.SaveToPart(OpenXmlPart openXmlPart)
    at DocumentFormat.OpenXml.OpenXmlPartRootElement.Save()
    at PersonalInjuryReportWriter.CreateSpreadsheet()
    at PersonalInjuryReportWriter.Page_Load(Object sender, EventArgs e)
    at System.Web.UI.Control.OnLoad(EventArgs e)
    at System.Web.UI.Control.LoadRecursive()
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    at System.Web.UI.Page.HandleError(Exception e)
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    at System.Web.UI.Page.ProcessRequest()
    at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
    at System.Web.UI.Page.ProcessRequest(HttpContext context)
    at ASP.personalinjuryreportwriter_aspx.ProcessRequest(HttpContext context)
    at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    


    Ray Pietrzak

    Tuesday, April 23, 2013 8:33 PM

Answers

All replies

  • Hi Ray

    This problem seems to come up on a fairly regular basis when large file sizes are involved. The following blog article describes what's going on in some detail and, at the bottom, offers a workaround

    http://www.kevinrohrbaugh.com/blog/tag/openxml

    Another approach is described at the end of this discussion

    http://www.windows-tech.info/4/b0ced821f8a2400e.php

    Another person mentions that a ClickOnce installation solved the issue for them, but given the information in the first link, this may only be relevant when not installing server-side

    http://social.msdn.microsoft.com/Forums/en-US/oxmlsdk/thread/d82e81f2-0813-4b70-8154-4678a1eaf628


    Cindy Meister, VSTO/Word MVP, my blog

    • Marked as answer by rspiet Wednesday, April 24, 2013 2:03 PM
    Wednesday, April 24, 2013 10:39 AM
    Moderator
  • Cindy, thank you. This does appear to be the issue. I only get the error when I ask for a relatively large amount of data. I'm not sure what that limit is, but if I use the same application and limit my search parameters to a smaller amount, the appliation does not error out.

    Ray Pietrzak

    Wednesday, April 24, 2013 2:05 PM
  • From my experience this issue is specific to Windows Server 2003.

    The best solution I found:

    "If you're running your application pool as "Network Service" granting at least Modify permissions for the Network Service account to "C:\Documents and Settings\Default User\Local Settings\Application Data\IsolatedStorage" will get you going.

    I had to create the IsolatedStorage directory on our server as it didn't exist."

    Source: http://epplus.codeplex.com/discussions/255537

    This is a much simpler solution than using impersonation or changing the AppDomain.

    In Windows Server 2008 the IsolatedStorage folder is located here: C:\ProgramData\IsolatedStorage

    • Marked as answer by rspiet Wednesday, October 2, 2013 2:40 PM
    Thursday, September 26, 2013 11:14 AM
  • Thanks for contributing your experience, James :-)

    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, October 2, 2013 2:39 PM
    Moderator