IronPDF 中的 GPU 處理問題:解決方案

This article was translated from English: Does it need improvement?
Translated
View the article in English
[0110/094441.173:ERROR:network_service_instance_impl.cc(521)] Network service crashed, restarting service.
[0110/094442.261:ERROR:gpu_process_host.cc(990)] GPU process exited unexpectedly: exit_code=255
[0110/094442.261:WARNING:gpu_process_host.cc(1337)] The GPU process has crashed 3 time(s)
[0110/094442.261:FATAL:gpu_data_manager_impl_private.cc(440)] GPU process isn't usable. Goodbye.

如果您在使用 IronPDF 時遇到類似上述的錯誤,特別是在 Azure 上部署時,您並非唯一遇到此問題的人。 此錯誤已知會導致應用程式當機,通常與位於 runtimes 資料夾中的 IronCefSubprocess.exe 有關,該檔案是 IronPDF 的關鍵組件。

可能的原因

導致此 GPU 處理程序錯誤的原因可能有以下幾種。 以下是一些最常見的原因:

  1. IronCefSubprocess 缺少執行權限

    IronCefSubprocess.exe 必須具備執行權限,IronPDF 才能正確初始化 ChromePdfRenderer 類別。

  2. 錯誤的 Azure 部署步驟

    在 Azure 環境中,IronPDF 的部署流程在 Linux 與 Windows 系統上有所不同。 若執行錯誤的步驟,可能會觸發此錯誤。

  3. 缺少 DLL 依賴項

    IronCefSubprocess.exe 需具備特定 DLL 檔案方能正常運作。 缺少 DLL 檔案(特別是在非 Windows 環境中)可能會導致程序失敗。

解決方案

本地環境

若您在本地端遇到此錯誤,請嘗試以下步驟:

  1. 停用 GPU 模式

    請在您的程式碼中加入以下這行,以停用 IronPDF 的 GPU 模式:

    // Disables GPU mode to prevent issues with GPU process crashes
    IronPdf.Installation.ChromeGpuMode = IronPdf.Engines.Chrome.ChromeGpuModes.Disabled;
    // Disables GPU mode to prevent issues with GPU process crashes
    IronPdf.Installation.ChromeGpuMode = IronPdf.Engines.Chrome.ChromeGpuModes.Disabled;
    ' Disables GPU mode to prevent issues with GPU process crashes
    IronPdf.Installation.ChromeGpuMode = IronPdf.Engines.Chrome.ChromeGpuModes.Disabled
    $vbLabelText   $csharpLabel
  2. 授予執行權限

    請確保 IronCefSubprocess.exe 具備執行權限。 在 Linux 系統中,請使用以下指令:

    # Grants execute permissions to IronCefSubprocess.exe
    chmod 755 IronCefSubprocess 
    # You may need to specify an exact path
    # IronCefSubprocess is typically found at bin/runtimes/linux-x64/
    # chmod 755 /bin/runtimes/linux-x64/native/IronCefSubprocess
    # In some cases you may need to use chmod 777 for broader permissions.
    # Grants execute permissions to IronCefSubprocess.exe
    chmod 755 IronCefSubprocess 
    # You may need to specify an exact path
    # IronCefSubprocess is typically found at bin/runtimes/linux-x64/
    # chmod 755 /bin/runtimes/linux-x64/native/IronCefSubprocess
    # In some cases you may need to use chmod 777 for broader permissions.
    SHELL
  3. 檢查是否缺少 DLL 檔案

    若上述步驟無法解決問題,請手動執行 IronCefSubprocess.exe 以檢查是否缺少 DLL 檔案。 系統將顯示一個錯誤視窗,指出缺失的 DLL 檔案。 安裝所需的 DLL 檔案,然後重新執行應用程式。

Azure 部署

若在將應用程式部署至 Azure 後發生此錯誤,請依照以下步驟操作:

  1. 使用 ZipDeploy

    請使用 ZipDeploy 部署您的應用程式,以確保所有檔案均已正確打包。

  2. 取消勾選"從套件檔案執行"

    部署時請確保"從套件檔案執行"選項未被勾選

  3. 適用於 Linux 的容器化

    若您的應用程式目標環境為 Linux,請考慮在部署至 Azure 之前,使用 Docker 將其容器化。 請參閱《Docker 設定指南》以獲取詳細說明。

  4. 啟用單一程序模式

    請加入以下程式碼,以強制 IronPDF 以單一程序模式執行:

    // Forces IronPDF to run in single-process mode to improve stability on Azure
    IronPdf.Installation.SingleProcess = true;
    // Forces IronPDF to run in single-process mode to improve stability on Azure
    IronPdf.Installation.SingleProcess = true;
    ' Forces IronPDF to run in single-process mode to improve stability on Azure
    IronPdf.Installation.SingleProcess = True
    $vbLabelText   $csharpLabel

若上述解決方案均無法解決問題,請提交工程支援請求以獲得個人化協助。

Curtis Chau
技術撰稿人

Curtis Chau 擁有卡爾頓大學(Carleton University)的電腦科學學士學位,專精於前端開發,並精通 Node.js、TypeScript、JavaScript 及 React。他熱衷於打造直觀且美觀的用戶介面,喜歡運用現代框架,並創建結構完善、視覺上吸引人的手冊。

除了開發工作之外,Curtis 對物聯網(IoT)抱有濃厚興趣,致力於探索整合硬體與軟體的創新方法。閒暇時,他喜歡玩遊戲和開發 Discord 機器人,將對科技的熱愛與創意相結合。

準備開始了嗎?
Nuget 下載 19,014,616 | 版本: 2026.5 just released
Still Scrolling Icon

還在往下捲動嗎?

想要快速確認成果嗎? PM > Install-Package IronPdf
執行範例 觀看您的 HTML 轉為 PDF。