0

我遇到以下错误:

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()

我只是想在一个循环中多次 (+- 300 docs) 将一个文档插入另一个文档。

有人知道为什么会这样吗?

此错误仅发生在服务器上,在我的机器上,一切运行正常。

4

1 回答 1

1

Docx Api 使用IsolatedStorage 来编写一些大文件。因此,IIS 需要具有对 IsolatedStorage 文件夹的读写权限。

因此,只需为 Pool User 或“Everyone”添加权限,即可在文件夹中读取和写入:“C:\Documents and Settings\Default User\Local Settings\Application Data\IsolatedStorage”

于 2013-01-14T22:25:14.060 回答