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缺少執行權限

    ChromePdfRenderer類。

  2. Azure部署步驟錯誤

    在Azure中,IronPDF的部署流程在Linux和Windows之間有所不同。 錯誤的步驟可能會觸發此錯誤。

  3. 缺少DLL相依性

    IronCefSubprocess.exe需要某些DLL檔案才能正常運行。 特別是在非Windows環境中,缺少DLL可能導致程式失敗。

解決方案

本地環境

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

  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. Use ZipDeploy

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

  2. 取消選擇從Package File運行

    確保在部署期間取消選擇**從Package File運行**選項。

  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大學的電腦科學學士學位,專精於前端開發,擁有Node.js、TypeScript、JavaScript和React的專業知識。Curtis熱衷於建立直觀且美觀的使用者介面,喜愛使用現代框架並建立結構良好、視覺吸引力的手冊。

除了開發,Curtis對物聯網(IoT)有濃厚的興趣,探索創新的方法來整合硬體和軟體。在空閒時間,他喜歡玩遊戲和建立Discord機器人,結合他對技術的熱愛與創造力。

準備開始了嗎?
Nuget 下載 20,296,129 | 版本: 2026.7 剛剛發布
Still Scrolling Icon

還在捲動嗎?

想快速獲得證明嗎? PM > Install-Package IronPdf
執行範例 看您的HTML變成PDF。