我们的正常工作流程是使用Windows计划的任务来:
这在Windows 2008上运行良好,但是自从我们升级到Windows 2019 (寿命结束和诸如此类)之后,我们就遇到了很多问题。我们现在陷入了第一个障碍--甚至实例化单词OLE客户端。错误是不一致的--前一天流程将成功完成,下一天它将立即失败。
我们的任务触发Dyalog APL工作区,其中要执行的代码位于其中。为了调试目的,我设置了一个简化版本,该版本正在执行以下操作:
tries←0 ⍝ Initialise the try counter
Log'Attempting to create Word instance' ⍝
:Repeat ⍝ Keep trying to...
Word←⎕NEW'OleClient'(⊂'ClassName' 'Word.Application') ⍝ Create the Word Client instance
Word.Visible←1 ⍝ making the application visible
tries+←1 ⍝ and incrementing the try counter each time
Log'Try: ',⍕tries ⍝
:Until #.Word.PropList∊⍨⊂'Documents' ⍝ Until it has seemingly created successfully
:OrIf tries≥maxTries_create ⍝ ... or the tries have exceeded the maximum (currently 5)
⍝
'doc open'delayAndLog dl_open ⍝ With an optional external delay...
myWordDoc←Word.Documents.Open⊂docPath ⍝ open the specified test doc
⍝
'doc close'delayAndLog dl_close ⍝ With an optional external delay...
myWordDoc.Close 0 ⍝ close the doc (not saving)
⍝
'application quit'delayAndLog dl_quit ⍝ With an optional external delay...
Word.Application.Quit 0 ⍝ quit the word client各种延迟都保存在配置文件的外部。我没有包括这个配置文件的读取,因为这里显示的本质是实质内容。注意:我重新尝试创建实例,因为有时我发现它只使用简单的方法实例化。拖延一下,或者重试,似乎解决了这个问题。
这段代码在我的非prod服务器(甚至有时在生产中)中将完全正常运行。今天,当我通过IDE运行它时,它将运行良好,但在作为Windows调度任务运行时,它将在打开文档时报告域错误。
我的观察是,它简要地创建了WINWORD.exe,也就是说,您可以在任务管理器中看到它,状态变为“暂停”,然后它消失。在事件查看器中,我们看到以下内容:
到目前为止我尝试过的事物,
当前已安装的版本:
在这个问题上,任何帮助都是非常感谢的,因为我觉得我在对付薛定谔的OLE客户。提前谢谢。
发布于 2021-11-09 13:55:54
c:\Users\AppData\Local\Temp\或c:\Users\AppData\Local\CrashDump中可能有崩溃转储文件。
在您的公司,如果您有任何C开发人员可以使用Visual或Windbg,他们可以打开转储文件并查看它是否提供了任何线索。
如果不是,我可以快速查看,如果你把它发送到Dyalog支持。
致以敬意,
文斯
https://stackoverflow.com/questions/69896550
复制相似问题