2

我有一个使用 .net 5 的 Asp web api 应用程序。该应用程序使用 Playwright 生成 pdf。它在 iis 上本地工作,没有任何问题。当我在下图中使用 docker windows 容器运行它时:

FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base

它抱怨缺少 Chromium。我尝试使用多种方式在该图像上安装剧作家,但失败了。该图像没有安装 dotnet .sdk 也没有 powershell。在我的 bin 文件夹中,我确实有 playwright 安装文件:

bin\Debug\net5.0\.playwright\node\win32_x64

如果我从那里跑:

playwright.cmd /install

它下载并安装浏览器二进制文件,但在我的 Asp 应用程序中,我现在收到有关缺少依赖项的错误:

PlaywrightException:主机系统缺少依赖项!

缺失库的完整列表:dwrite.dll uiautomationcore.dll winspool.drv dxgi.dll

我在 Linux 容器上尝试了类似的方法,但结果相似。Playwright 教程中使用“dotnet tool”命令的方法不起作用,因为没有 dotnet sdk。

让 Playwright 处理该 asp 图像的最佳方法是什么?

4

0 回答 0