OpenXml and Unable to create mutex

后端 未结 4 1495
Happy的楠姐
Happy的楠姐 2021-01-06 13:00

I tried to create Excel document through openXml lib, but when i wanna create Excel from large number of data, server shoe me Unable to create mutex. (Exception from

相关标签:
4条回答
  • 2021-01-06 13:42

    I change application pool Identity to higher level account with full control access in IIS.

    IIS> application pools>advanced setting>Identity (in process mode)>choose an account with higher access

    0 讨论(0)
  • 2021-01-06 13:49

    I agree with @Behrooz, change the the ApplicationPool's Identity to LocalSystem and it will work.

    I didn't have this problem when the project was running on my PC's local host, but I did when I deployed it to the Server..

    See this screenshot:

    enter image description here

    0 讨论(0)
  • 2021-01-06 13:50

    It also seems that changing ApplicationPool's Identity to LocalSystem does not always help which was in my case with Windows Server 2009 R2. The strange thing is that it worked for about half a year since I have read this topic and fixed my problem with large OpenXML-based reports but several days ago it just stopped working.

    So after a day of research I found that additionally in ApplicationPool's Advanced Settings set Load User Profile to True (default value was False) and no problems again.

    0 讨论(0)
  • 2021-01-06 13:53

    OpenXML uses IsolatedStorage for large file sizes. More info at http://www.lyquidity.com/devblog/?p=65

    You can find isolatedStorage folder in C:\Users\username\AppData\Local. What we found was that when this folder was empty we weren't getting the "Unable to create Mutex" exception. We also weren't getting the exception right after we would restart our IIS. We figured out it's got to be something to do with other web apps using and locking that folder, hence the mutex exception from OpenXml.

    After more searching we found that DotNetOpenAuth might also be using Isolated storage as per https://github.com/DotNetOpenAuth/DotNetOpenAuth/issues/381 for it's reporting feature. Some of our apps were using it and the moment they started up they would create files and folders in the IsolatedStorage folder after which the Mutex exception would start happening.

    You can disable DotNetOpenAuth reporting by changing the following flag to false in your Web.config

    <reporting enabled="true"/>
    

    This fixed it for us

    0 讨论(0)
提交回复
热议问题