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

