OpenXML, IsolatedStorage, NETWORK SERVICE, and Windows Server 2008

I have a great web application. One very small part of this web application generates XLSX files using the OpenXML library (written in C #).

I ran into the problem described in this post: Denied disconnected storage was denied

However, the instructions for Windows Server 2003 and the user directory hierarchy in 2008 are different.

I tried to create the IsolStorage directory in these places (and then granted it NETWORK SERVICE permissions):

C: \ Users \ Default \ AppData \ Local \ IsolatedStorage C: \ Users \ Default \ AppData \ Roaming \ IsolatedStorage

Those did not work. I tried to find where the appropriate location for the IsolStorage directory is on Windows Server 2008 (usually using Google and specifically here) without success.

Can someone tell me where I should create this directory (or, alternatively, suggest another solution that will force OpenXML to tell the archive library not to use IsolStorage to create the spreadsheet)?

Edit - July 14, 2011 - Adding an exception message and stack trace so that it, hopefully, helps others find this.

Exception: System.ApplicationException Message: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) Source: mscorlib 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 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.EnsureIsolatedStoreStream() at MS.Internal.IO.Packaging.SparseMemoryStream.SwitchModeIfNecessary() at MS.Internal.IO.Zip.ZipIOFileItemStream.Write(Byte[] buffer, Int32 offset, Int32 count) at System.IO.Compression.DeflateStream.InternalWrite(Byte[] array, Int32 offset, Int32 count, Boolean isAsync) at System.IO.Compression.DeflateStream.Write(Byte[] array, 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.Packaging.OpenXmlPackage.SavePartContents() at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Dispose(Boolean disposing) at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Close() 
+4
source share
2 answers

During my research, I came across this blog post: http://www.kevinrohrbaugh.com/blog/tag/openxml

At first, I rejected it because I was unable to get my application to impersonate another user due to the way it interacts with another web application in which I do not control.

However, I thought that maybe I got rid of the registry entry for NETWORK SERVICE in ProfileList, I could get the same result.

So, I renamed HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ ProfileList \ S-1-5-20 to HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ ProfileList \ S-1-5-20-backup and restart my export is excel and it works correctly. As far as I can tell, I have no negative results from this.

+4
source

[I would add this as a comment, but I do not have permission ...]

Hope this helps someone else ...

I have an application running in IIS Express as a network service on Windows Server 2008 R2. The isolated storage store that returns from the call to IsolatedStorageFile.GetMachineStoreForDomain () is located at: c: \ ProgramData \ IsolatedStorage

0
source

All Articles