解决 IronPDF 中的 Chrome 浏览器依赖性问题。
Google Chromium HTML渲染器是IronPDF"Html转PDF"渲染过程的重要组成部分。 这个渲染器的必要二进制文件应可在IronPDF NuGet包中找到。 项目文件夹中缺少此二进制文件将抛出以下错误:
Unhandled exception. IronSoftware.Exceptions.IronSoftwareDeploymentException: Error while deploying IronPdf Chrome renderer: 'Unable to locate 'IronInterop'.如果IronPDF无法自动部署Chrome依赖,可能需要通过NuGet手动添加到项目中。 可以添加多种依赖:
在Windows上,确保目标操作系统安装了Visual C++ Runtimes是个好主意。 许多现代应用程序无法在没有这个重要的操作系统组件的情况下运行。
Linux
- 确保使用正确的Docker文件。
- 使用IronPdf.Linux NuGet包而不是IronPdf。
设置Chrome渲染的GPU模式为禁用:
IronPdf.Installation.ChromeGpuMode = IronPdf.Engines.Chrome.ChromeGpuModes.Disabled;IronPdf.Installation.ChromeGpuMode = IronPdf.Engines.Chrome.ChromeGpuModes.Disabled;IronPdf.Installation.ChromeGpuMode = IronPdf.Engines.Chrome.ChromeGpuModes.Disabled$vbLabelText $csharpLabel禁用Linux和Docker依赖的自动配置:
csharp Installation.LinuxAndDockerDependenciesAutoConfig = false;csharp Installation.LinuxAndDockerDependenciesAutoConfig = false;csharp Installation.LinuxAndDockerDependenciesAutoConfig = False$vbLabelText $csharpLabel
MacOS
- 检查.NET运行时设置为正确的架构 - x64或arm64。
如果这不能解决问题怎么办?
如果这不能解决问题,我们随时准备提供帮助。兼容性是我们工程团队的重中之重。 请发送电子邮件错误报告至 support@ironsoftware.com。 所有兼容性问题将由高级工程师认真审查。
务必告知我们正在部署的操作系统/平台,特别是如果是像AWS或Azure这样的云平台。
如何在IronPDF中启用本机日志记录
附加日志文件到错误报告中可以使我们隔离问题并迅速解决的概率增加一倍以上。
在运行任何IronPDF方法之前,将此放置在代码顶部(所有2021.3.1之后的版本):
// Set the log file path, this can be a directory or a full file path
IronPdf.Logging.Logger.LogFilePath = "Default.log";
// Enable all logging modes for detailed logging information
IronPdf.Logging.Logger.LoggingMode = IronPdf.Logging.Logger.LoggingModes.All;// Set the log file path, this can be a directory or a full file path
IronPdf.Logging.Logger.LogFilePath = "Default.log";
// Enable all logging modes for detailed logging information
IronPdf.Logging.Logger.LoggingMode = IronPdf.Logging.Logger.LoggingModes.All;' Set the log file path, this can be a directory or a full file path
IronPdf.Logging.Logger.LogFilePath = "Default.log"
' Enable all logging modes for detailed logging information
IronPdf.Logging.Logger.LoggingMode = IronPdf.Logging.Logger.LoggingModes.AllIronPDF生成的日志文件位于DLL部署的项目/bin目录中:
- default.log(部署过程)
- cef.log(渲染)
- IronSoftwareCefSubprocess.log(渲染与线程)
- IronSoftwareEngine.log(对调试以"从...生成 PDF 错误"开头的异常非常有用)






