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 頁面。
如果您需要進一步的協助,請提交 工程請求。

