IronPDF 中的原生异常处理
Curtis Chau
Updated: 2026年4月24日
在IronPDF的最新版本中,日志中的本地异常消息将包含一个特定的问题代码:[问题代码 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]
Text
可能原因
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.AllIronPDF创建的日志文件通常位于项目的**/bin目录**中,即DLL部署的位置,或者您可以设置一个自定义的IronPdf.Logging.Logger.LogFilePath来将日志文件存储在特定位置。 相关的日志文件包括:
- Default.log:包含与部署、线程和渲染过程的相关信息。 它对于观察过程行为和异常很有用。
- cef.log:包含Chrome Embedded Framework过程的日志。
请注意: 在较旧版本的IronPDF中,日志文件可能还包括
IronSoftwareEngine.log。 请在请求工程支持时提交所有生成的日志文件。对于云服务器,日志文件可能位于特定目录中。 请参阅我们关于在Azure和AWS中生成日志文件的指南。

技术作家
Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。
...
阅读更多