我有一个在 SBS 2008 服务器上运行的程序,该服务器安装了 Office 2007,并在通过电子邮件发送的 Excel 文件中创建报告。我正在使用 NetOffice 来创建 Excel 文件,并且它在大多数情况下都能正常工作。但是,它经常抛出 File Not Found 异常并失败。
完整的例外是:
内部异常:System.IO.FileNotFoundException:检索具有 CLSID {00024500-0000-0000-C000-000000000046} 的组件的 COM 类工厂失败,原因是以下错误:8007007e 找不到指定的模块。(来自 HRESULT 的异常:0x8007007E)。在 System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType) 在 System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType) 在 System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] 道具, Boolean bNewObj) 在 System.RuntimeTypeHandle.CreateInstance(RuntimeType 类型, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) 在 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly,
如果我立即重新运行该程序,它将始终成功运行。
我已经尝试全部重建,替换服务器上的文件,在 VS 2019 和 2017 中编译。