[英]Creating Word OLE Client from a Windows Scheduled Task causes ntdll application error
我們的正常工作流程是使用 Windows 計划任務來:
這在 Windows Server 2008 上運行良好,但自從我們升級到 Windows Server 2019(生命周期結束等等)以來,我們遇到了很多問題。 我們現在在第一個障礙上失敗了 - 甚至實例化 Word 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
各種延遲都保存在配置文件中。 我沒有包括對這個配置文件的閱讀,因為基本上這里顯示的是實質內容。 注意:我重試創建實例,因為有時我發現它只使用准系統方法實例化。 延遲或重試似乎可以解決這個問題。
這段代碼將在我的非生產服務器(甚至有時在生產中)中完全正常運行。 今天,當我通過 IDE 運行它時,它會運行良好,但是當作為 Windows 計划任務運行時,它會在打開文檔時報告 DOMAIN ERROR。
我的觀察是它簡要地創建了 WINWORD.exe,即您可以在任務管理器中看到它,狀態變為“掛起”,然后消失。 在事件查看器中,我們看到以下內容:
事件查看器 - ntdll 應用程序錯誤 (id: 1000)
到目前為止我嘗試過的事情
當前安裝的版本:
對此的任何幫助都將不勝感激,因為我覺得我正在處理 Schrödinger 的 OLE 客戶端。 提前致謝。
c:\\Users<yourname>\\AppData\\Local\\Temp\\ 或 c:\\Users<yourname>\\AppData\\Local\\CrashDumps 中可能存在故障轉儲文件。
在您的公司,如果您有任何可以使用 Visual Studio 或 Windbg 的 C 開發人員,他們可以打開轉儲文件並查看它是否提供任何線索。
如果沒有,如果您將其發送給 Dyalog 支持,我可以快速查看。
問候,
文斯
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.