使用本地系统帐户间歇性找不到.net dll

使用本地系统帐户间歇性找不到.net dll,.net,dll,openxml,.net,Dll,Openxml,我有一个.Net工具,它使用OpenXMLSDK生成电子表格。这几个月来一直运作良好。突然,我间歇性地出现了这样的错误: Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The specified module could not be

我有一个.Net工具,它使用OpenXMLSDK生成电子表格。这几个月来一直运作良好。突然,我间歇性地出现了这样的错误:

Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The specified module could not be found.
DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
System.IO.FileNotFoundException: Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The specified module could not be found.
File name: 'DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ---> System.IO.FileNotFoundException: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at ConvertXMLtoExcel.ExcelGenerator.CreatePackage(String filePath)
   at ConvertXMLtoExcel.Program.Main(String[] args)


System.IO.FileNotFoundException: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
我已经验证了DocumentFormat.OpenXml.dll文件在GAC中。当我从命令提示符手动运行该工具时,它在100%的时间内工作。它在我的开发机器(Windows7)上100%工作

但是,当web服务(Apache->PHP->exec)调用该命令时,除了上述异常,大约有50%的时间失败

我花了太长时间研究这个问题,结果什么也没想到

我读过的最好的解释是32/64位兼容性问题或GAC中缺少DLL。但是这些会导致100%的失败,对吗?即使以用户身份登录

我已经在这个过程中运行了sys-internal-ProcMon,并捕获了它的成功和失败。他们有很大的不同。如果我通过“加载图像”过滤列表,我可以看到它们的开始完全相同,直到某一点

下一个加载“C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll”,失败的不加载,而是加载“C:\WINDOWS\system32\faultrep.dll”


谢谢你的建议

它找不到所需的DLL,即非托管DLL。它应该在ProcMon日志中可见,您应该看到它在路径中搜索缺少的DLL。它找不到所需的DLL,即非托管DLL。它应该在ProcMon日志中可见,您应该可以看到它在路径中搜索缺少的DLL。