BuildDocumentToByte - Unable to create mutex

Jun 22, 2015 at 6:54 AM
Edited Jun 22, 2015 at 6:55 AM
Hi,
Thanks in advance for any help.

I have an ASP.Net 4 web app project and is hosted on IIS. If the application is run under LocalSystem account everything works fine. Obviously this is not ideal but if I run under applicationpool then I have the following issue.

The following line of code is producing the below error.
      Dim final As Byte() = New DocumentBuilder().BuildDocumentToByte(sources)
[IsolatedStorageException: Unable to create mutex. (Exception from HRESULT: 0x80131464)]
System.IO.IsolatedStorage.IsolatedStorageFile.Open(String infoFile, String syncName) +0
   System.IO.IsolatedStorage.IsolatedStorageFile.Lock(Boolean& locked) +370
   System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, IsolatedStorageFile isf) +474
   System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, IsolatedStorageFile isf) +35
   MS.Internal.IO.Packaging.SafeIsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, ReliableIsolatedStorageFileFolder folder) +102
   MS.Internal.IO.Packaging.PackagingUtilities.CreateUserScopedIsolatedStorageFileStreamWithRandomName(Int32 retryCount, String& fileName) +276
   MS.Internal.IO.Packaging.SparseMemoryStream.EnsureIsolatedStoreStream() +31
   MS.Internal.IO.Packaging.SparseMemoryStream.SwitchModeIfNecessary() +383
   MS.Internal.IO.Packaging.CompressEmulationStream.Write(Byte[] buffer, Int32 offset, Int32 count) +73
   MS.Internal.IO.Packaging.CompressStream.Write(Byte[] buffer, Int32 offset, Int32 count) +414
   MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Write(Byte[] buffer, Int32 offset, Int32 count) +168
   MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Write(Byte[] buffer, Int32 offset, Int32 count) +120
   System.Xml.XmlUtf8RawTextWriter.FlushBuffer() +7333731
   System.Xml.XmlUtf8RawTextWriter.RawText(Char* pSrcBegin, Char* pSrcEnd) +232
   System.Xml.XmlUtf8RawTextWriter.WriteStartElement(String prefix, String localName, String ns) +124
   System.Xml.XmlWellFormedWriter.WriteStartElement(String prefix, String localName, String ns) +7339748
   System.Xml.Linq.ElementWriter.WriteStartElement(XElement e) +175
   System.Xml.Linq.ElementWriter.WriteElement(XElement e) +70
   System.Xml.Linq.XElement.WriteTo(XmlWriter writer) +149
   System.Xml.Linq.XContainer.WriteContentTo(XmlWriter writer) +228
   System.Xml.Linq.XDocument.WriteTo(XmlWriter writer) +155
   OpenXmlPowerTools.PtOpenXmlExtensions.PutXDocument(OpenXmlPart part) +205
   OpenXmlPowerTools.DocumentBuilder.BuildDocument(List`1 sources, WordprocessingDocument output) +8576
   OpenXmlPowerTools.DocumentBuilder.BuildDocumentToByte(List`1 sources) +130
So it seems as though this is a permission issue but I am unable to work out what permissions I should grant the iis_usr account in windows. While trying to debug I gave this account full access to the web folder but this still didnt resolve the issue.

Does anyone have any ideas how to resolve?

Trent.