Native Exception Handling in IronPDF

This article was translated from English: Does it need improvement?
Translated
View the article in English

在 IronPDF 的最近版本中,日誌中的原生異常信息將包含一個特定的問題代碼:[Issue Code IRONPDF-NATIVE-EXCEPTION]。 以下顯示了一個此類異常信息的示例:

IronPdf.Exceptions.IronPdfNativeException: Error while generating PDF from HTML: 'Error while rendering pdf from html for job group 0: 'Error during dev tools execution: {"method":"Inspector.targetCrashed","params":{}}''.
2024-01-25 08:12:11,960 INFO  [Thread-3] [, , , , , , , , ] c.i.i.i.s.Access: [IronPdfEngine] To learn how to solve this issue please read https://ironpdf.com/troubleshooting/ironpdf-native-exception [Issue Code IRONPDF-NATIVE-EXCEPTION]

可能原因

IronPDF 原生異常通常源於 IronPDF 中使用的 C++ 代碼,涉及到使用 Chrome PDF 渲染引擎的 IronPdf.Native.Chrome 包的各種問題。

解決方案

要獲得與原生異常相關問題的幫助,請提交工程支持請求,並提供完整的日誌文件以便進一步調查。

通過將以下代碼片段包含在您的項目中啟用原生日誌記錄:

// Set the path for the log file. 
// This can be a directory name or a specific file path. Here, we set it to "Default.log".
IronPdf.Logging.Logger.LogFilePath = "Default.log";

// Enable logging for all modes to capture comprehensive details
IronPdf.Logging.Logger.LoggingMode = IronPdf.Logging.Logger.LoggingModes.All;
// Set the path for the log file. 
// This can be a directory name or a specific file path. Here, we set it to "Default.log".
IronPdf.Logging.Logger.LogFilePath = "Default.log";

// Enable logging for all modes to capture comprehensive details
IronPdf.Logging.Logger.LoggingMode = IronPdf.Logging.Logger.LoggingModes.All;
' Set the path for the log file. 
' This can be a directory name or a specific file path. Here, we set it to "Default.log".
IronPdf.Logging.Logger.LogFilePath = "Default.log"

' Enable logging for all modes to capture comprehensive details
IronPdf.Logging.Logger.LoggingMode = IronPdf.Logging.Logger.LoggingModes.All
$vbLabelText   $csharpLabel

IronPDF 創建的日誌文件通常位於部署 DLL 的/bin 目錄中,或者您可以設置自定義IronPdf.Logging.Logger.LogFilePath來將日誌文件存儲在特定位置。 相關日誌文件包括:

  • Default.log:包含有關部署、線程和渲染過程的信息。 有助於觀察過程行為和異常。
  • cef.log:包含 Chrome 嵌入式框架過程的日誌。

請注意在舊版本的 IronPDF 中,日誌文件可能還包括IronSoftwareEngine.log。 請在申請工程支持時提交所有生成的日誌文件。

對於雲服務器,日誌文件可能位於特定目錄中。 Refer to our guides for generating log files in Azure and AWS.

Curtis Chau
技術作家

Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。

除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。

準備好開始了嗎?
Nuget 下載 16,154,058 | 版本: 2025.11 剛剛發布