c# – OpenXml并且无法创建互斥锁
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了c# – OpenXml并且无法创建互斥锁,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含4641字,纯文字阅读大概需要7分钟。
内容图文
我试图通过openXml lib创建Excel文档,但是当我想从大量数据创建Excel时,我无法创建互斥锁. (来自HRESULT的异常:0x80131464)错误,
堆栈跟踪是:
[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) +468
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() +400
MS.Internal.IO.Packaging.CompressEmulationStream.Write(Byte[] buffer, Int32 offset, Int32 count) +76
MS.Internal.IO.Packaging.CompressStream.Write(Byte[] buffer, Int32 offset, Int32 count) +431
MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Write(Byte[] buffer, Int32 offset, Int32 count) +177
MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Write(Byte[] buffer, Int32 offset, Int32 count) +130
System.Xml.XmlUtf8RawTextWriter.FlushBuffer() +7519035
System.Xml.XmlUtf8RawTextWriter.RawText(Char* pSrcBegin, Char* pSrcEnd) +232
System.Xml.XmlUtf8RawTextWriter.WriteStartElement(String prefix, String localName, String ns) +192
System.Xml.XmlWellFormedWriter.WriteStartElement(String prefix, String localName, String ns) +7517920
DocumentFormat.OpenXml.OpenXmlElement.WriteTo(XmlWriter xmlWriter) +283
DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo(XmlWriter w) +114
DocumentFormat.OpenXml.OpenXmlElement.WriteTo(XmlWriter xmlWriter) +316
DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo(XmlWriter w) +114
DocumentFormat.OpenXml.OpenXmlPartRootElement.WriteTo(XmlWriter xmlWriter) +404
DocumentFormat.OpenXml.OpenXmlPartRootElement.SaveToPart(OpenXmlPart openXmlPart) +217
DocumentFormat.OpenXml.Packaging.OpenXmlPackage.SavePartContents() +203
DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Dispose(Boolean disposing) +32
DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Dispose() +24
Yara.Evento.Utility.Office.Excel.Write.Do(List`1 objects, String sheetName, HeaderList headerNames) +2371
Yara.Evento.Management.Web.Controllers.TicketController.List(String button, Nullable`1 page, String startDate, String endDate, String ownerMail, String eventName, String mobile, String eMail, String ticketCode, Int32 sort, Boolean desc, Int32 eventId, Int32 status, Int32 variantId) +13628
lambda_method(Closure , ControllerBase , Object[] ) +864
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +264
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +124
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +726390
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +309
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +726324
System.Web.Mvc.Controller.ExecuteCore() +159
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +334
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +15
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +52
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
解决方法:
似乎将ApplicationPool的Identity更改为LocalSystem并不总是有助于我在Windows Server 2009 R2中的情况.奇怪的是,它已经工作了大约半年,因为我已经阅读了这个主题并修复了基于OpenXML的大型报告的问题,但几天前它就停止了工作.
经过一天的研究后,我发现另外在ApplicationPool的高级设置中将加载用户配置文件设置为True(默认值为False)并且没有问题.
内容总结
以上是互联网集市为您收集整理的c# – OpenXml并且无法创建互斥锁全部内容,希望文章能够帮你解决c# – OpenXml并且无法创建互斥锁所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。