Troubleshooting Chrome Dependencies in IronPDF

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

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手动添加到项目中。 可以添加多种依赖:

请注意在IronPDF的后续版本中,如果项目文件夹中缺少所需二进制文件,它们将根据运行时使用的操作系统从NuGet源自动下载。 只要项目连接到互联网并对项目文件夹具有读取、写入和执行权限,这将会成功。

在Windows上,确保目标操作系统安装了Visual C++ Runtimes是个好主意。 许多现代应用程序无法在没有这个重要的操作系统组件的情况下运行。

We also have compatibility guides for Linux and Docker.

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.All
$vbLabelText   $csharpLabel

IronPDF生成的日志文件位于DLL部署的项目/bin目录中:

  • default.log(部署过程)
  • cef.log(渲染)
  • IronSoftwareCefSubprocess.log(渲染与线程)
  • IronSoftwareEngine.log(对调试以“从...生成 PDF 错误”开头的异常非常有用)

云服务器通常有特定的日志文件存放位置。 We have 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 刚刚发布