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.Native.Chrome套件中的C++程式碼相關的各種問題引起,該套件是IronPDF的相依性,並涉及使用Chrome PDF呈現引擎。

解決方案

如需相關原生例外問題的協助,請提交工程支援請求,並提供完整的日誌檔案以進一步調查。

透過在您的專案中包含以下程式碼片段來啟用原生日誌紀錄:

// 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。 請提交請求工程支援時生成的所有日誌檔案。

對於雲端伺服器,日誌檔案可能位於特定目錄中。 請參閱我們的指南,以在AzureAWS生成日誌檔案。

Curtis Chau
技術作家

Curtis Chau擁有Carleton大學的電腦科學學士學位,專精於前端開發,擁有Node.js、TypeScript、JavaScript和React的專業知識。Curtis熱衷於建立直觀且美觀的使用者介面,喜愛使用現代框架並建立結構良好、視覺吸引力的手冊。

除了開發,Curtis對物聯網(IoT)有濃厚的興趣,探索創新的方法來整合硬體和軟體。在空閒時間,他喜歡玩遊戲和建立Discord機器人,結合他對技術的熱愛與創造力。

準備開始了嗎?
Nuget 下載 19,936,792 | 版本: 2026.7 剛剛發布
Still Scrolling Icon

還在捲動嗎?

想快速獲得證明嗎? PM > Install-Package IronPdf
執行範例 看您的HTML變成PDF。