SetLogEvent 未找到:IronPDF 修正方案
No function was found with the name SetLogEvent with error code (127)
錯誤訊息中提到的 SetLogEvent 是指 IronPDF 函式庫中某個未能成功執行的方法,導致此例外發生。
可能原因
此例外情況通常發生在使用者升級專案中的 IronPdf.Slim 版本,卻未同步更新其依賴套件,尤其是 IronPdf.Native.Chrome.Windows 或 IronPdf.Native.Chrome.Linux(針對基於 Linux 的系統)。 此版本不匹配可能導致相容性問題,進而引發上述的執行時錯誤訊息。
解決方案
為避免此問題,建議在安裝新版之前,先透過 NuGet 套件管理員移除舊版 IronPDF。 這可確保移除先前套件的所有殘留檔案,避免潛在的衝突。 此外,此方法將自動將所有依賴套件更新至與新版 IronPDF 相容的版本。
此外,若您僅使用 IronPdf.Slim 套件,可在專案中加入以下程式碼:
// Enabling automatic download of compatible native binaries for IronPDF
IronPdf.Installation.AutomaticallyDownloadNativeBinaries = true;
// Enabling automatic download of compatible native binaries for IronPDF
IronPdf.Installation.AutomaticallyDownloadNativeBinaries = true;
' Enabling automatic download of compatible native binaries for IronPDF
IronPdf.Installation.AutomaticallyDownloadNativeBinaries = True
此程式碼將在您的專案首次執行時,自動下載相容版本的依賴套件。 一旦下載完成,除非重新啟動或完全重置工作階段,否則無需再次下載。
有關 IronPDF 依賴項的相容版本資訊,請參閱 IronPDF 和 IronPdf.Slim 的 NuGet 頁面。
若需進一步協助,請提交工程支援請求。

