Bruno Croys Felthes
Bruno Croys Felthes

Reputation: 1203

Initialization Failed at DocX file Saving

I'm having the following error:

Message: Initialization failed.
Source: mscorlib
Stack Trace: 
   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.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
   at System.IO.StreamWriter.Write(Char[] buffer, Int32 index, Int32 count)
   at System.Xml.XmlEncodedRawTextWriter.FlushBuffer()
   at System.Xml.XmlEncodedRawTextWriter.RawText(Char* pSrcBegin, Char* pSrcEnd)
   at System.Xml.XmlEncodedRawTextWriter.RawText(String s)
   at System.Xml.XmlEncodedRawTextWriter.WriteStartAttribute(String prefix, String localName, String ns)
   at System.Xml.XmlEncodedRawTextWriterIndent.WriteStartAttribute(String prefix, String localName, String ns)
   at System.Xml.XmlWellFormedWriter.WriteStartAttribute(String prefix, String localName, String namespaceName)
   at System.Xml.Linq.ElementWriter.WriteStartElement(XElement e)
   at System.Xml.Linq.ElementWriter.WriteElement(XElement e)
   at System.Xml.Linq.XElement.WriteTo(XmlWriter writer)
   at System.Xml.Linq.XContainer.WriteContentTo(XmlWriter writer)
   at System.Xml.Linq.XDocument.WriteTo(XmlWriter writer)
   at System.Xml.Linq.XDocument.Save(TextWriter textWriter, SaveOptions options)
   at System.Xml.Linq.XDocument.Save(TextWriter textWriter)
   at Novacode.DocX.InsertDocument(DocX document)
   at SpringWireless.Common.Server.Ws.IntegrationStudio.ProjectDocumentation.Factory.GenerateNewFile()

I'm just trying to Insert a Document to Another, several times (+- 300 docs) , in a loop.

Anyone know why it is happening?

This error happens only at the server, at my machine, everething runs fine.

Upvotes: 0

Views: 351

Answers (1)

Bruno Croys Felthes
Bruno Croys Felthes

Reputation: 1203

The Docx Api uses the IsolatedStorage to write some big files. So, the IIS needs to have permissions to read and write at the IsolatedStorage folder.

So, just add permission for the Pool User or "Everyone", to read and write at the folder: "C:\Documents and Settings\Default User\Local Settings\Application Data\IsolatedStorage"

Upvotes: 1

Related Questions