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.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 Embedded Framework过程的日志。

请注意在较旧版本的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 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。

准备开始了吗?
Nuget 下载 16,154,058 | 版本: 2025.11 刚刚发布