Open RacovitaCalin opened 1 year ago
@RacovitaCalin please redact PII in the future, especially of other people. I've removed the email signature of the person you were communicating with
First off, the version you are using is very old. Please update to 2.20.0 and see if it repros. Other than that, we would need some sample code to see what is occurring.
Of the top of my head, this may be a known issue if you are hosting it in a separate app domain. Is that the case? This is how SQL server handles in-proc assemblies that are loaded by them.
ISSUE DISCRIPTION This error occurs when trying to export a large Excel file using the DocumentFormat.OpenXml.dll library, version 2.5.5631.0. For small files the export works. The application is developed using .NET Framework 4.7.1 C#, hosted in a IIS server (Windows server 2016). This issue appears only in Production environment and we cannot change the application without business approval. The below error is displayed: Error Message: Unable to create mutex. (Exception from HRESULT: 0x80131464) Error Stack Trace: at System.IO.IsolatedStorage.IsolatedStorageFile.Open(String infoFile, String syncName) at System.IO.IsolatedStorage.IsolatedStorageFile.Lock(Boolean& locked) at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, IsolatedStorageFile isf) at MS.Internal.IO.Packaging.PackagingUtilities.SafeIsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, ReliableIsolatedStorageFileFolder folder) 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.Xml.XmlUtf8RawTextWriter.FlushBuffer() at System.Xml.XmlUtf8RawTextWriter.RawText(Char pSrcBegin, Char pSrcEnd) at System.Xml.XmlUtf8RawTextWriter.RawText(String s) at System.Xml.XmlUtf8RawTextWriter.WriteEndElement(String prefix, String localName, String ns) at System.Xml.XmlWellFormedWriter.WriteEndElement() 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.TrySavePartContent(OpenXmlPart part) at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.SavePartContents() at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Dispose(Boolean disposing) at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Dispose() at ExeLib.OfficeOpenXml.ExcelDocument.GetStream() at FCPI.Controllers.ActionController.ExportExcel(String ProcedureName, Int32 IDAuthorizationKey, Int32 IDSubmission, Nullableb 41()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>cDisplayClass37.<>cDisplayClass39.b33()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>cDisplayClass4f.b49()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>cDisplayClass4f.b49()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>cDisplayClass25.<>cDisplayClass2a.b 20()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>cDisplayClass25.b 22(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.<>cDisplayClass1d.b 18(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>cDisplayClass4.b 3(IAsyncResult ar)
at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>cDisplayClass4.b 3(IAsyncResult ar)
at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.<>cDisplayClass8.b 3(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>cDisplayClass4.b 3(IAsyncResult ar)
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult
1 IDFileType) in C:\Users\ANDREIZ\source\repos\BUC - FCPI\FCPI\Controllers\ActionController.cs:line 106 at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary
2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>cDisplayClass42.We had a Microsoft ticket opened and they said that this error is not from their system and that we should check with your team.
Hi Ionela, Hi everyone,
I hope you are doing well!
I am reaching out to you about our support request together – as explained by my colleague Apoorva and myself previously, it seems that the configuration from an IIS point-of-view is working fine on both servers, and the issue is pointing towards OpenXML before Office is involved. I have discussed the situation with my manager (in CC), and as we are not able to assist further with this issue from an Office perspective, we will proceed with placing our support request into archival. If you have further questions within the scope of this issue, please do reopen the support request!
You may receive an invitation from Microsoft to complete a brief web feedback request. Your feedback is very important to us. We use it to continually improve our service. We would appreciate it if you can take the time to complete this feedback request.
In addition, if you would like to discuss any feedback or the case itself, you can contact me or my manager using the contact information in my signature.
Below is a summary of the support request for your records:
Issue: With one of the production servers, there is an error that occurs when trying to export an Excel file by using a function with OpenXML, which receives some information from an SQL server and executes a stored procedure – the error says “Unable to create mutex. (Exception from HRESULT: 0x80131464)”. The error does not occur on any other server or locally, and also has occurred before but has disappeared and reappeared in the meantime.
Scope: We will consider this case solved when the script executes successfully on the affected server, if technically achievable. Also, if we provide a technical answer on why this goal is not reachable under the given Scenario/Architecture, the issue will be considered solved. If the causes are related to 3rd party code, we can only explain them and act as resource for you when addressing the issue with the 3rd party support.
Assessment: As the configuration from an IIS point-of-view is correct and works as expected on both servers, and the issue occurs before Office is involved with OpenXML, our recommendation is to open a new issue on the OpenXML team’s GitHub page and explain the situation there; this way, the library’s team would be able to provide more information on what is causing this behaviour. Here is the link for their GitHub page for when you have the opportunity: Issues · dotnet/Open-XML-SDK · GitHub
Can you please help us understand why this happens and how we can still use the OpenXML library and make it work?
Issue Description.docx