Open XML sdk 2.5 crashes our IIS instance

389 views Asked by At

We are using Open XML SDK to create a report in word. However if there is to clients requiring the same report it makes our IIS instance to hang and not able to provide reports until restart. I have identified that below code makes IIS hang.

using(WordprocessingDocument o = WordProcessesingDocument.Open(stream, true)
{
  //some processing
}

When there is one client asking for the report it works fine, but every time more than one client asks for report it hangs there. Has anyone had similar issues or have some good tip about what could be wrong? I can see from our log that the requests are running in different threads.

1

There are 1 answers

0
petelids On

This is due to Isolated Storage. If the file you are reading is large enough (>10MB) then Isolated Storage is used by System.IO.Packaging (which is used by OpenXML).

Isolated Storage can error if it is accessed from multiple threads simultaneously or by multiple assemblies with the same strong name (as would be your case here). More details can be found on Eric White's blog here. Fortunately, on the same blog Eric details a fix that he has produced in version 2.6 of the framework where is has re-written System.IO.Packaging so it no longer uses Isolated Storage. Upgrading to that version will fix your issue.