在Linux和WSL上未使用许可证密钥时的Win32Exception
This article was translated from English: Does it need improvement?
Translated
View the article in English
在Ubuntu、WSL或Docker容器中运行IronPDF而没有许可证密钥时,应用程序会抛出一个引用xdg-open的异常。
System.ComponentModel.Win32Exception: An error occurred trying to start process 'xdg-open' with working directory '/path/to/your/project/bin/Debug/net7.0'. No such file or directory
发生此错误必须同时满足三个条件:运行在Linux或WSL上、未配置IronPDF许可证密钥且xdg-open未安装。 没有许可证密钥,IronPDF会尝试使用xdg-open打开浏览器以显示试用通知。 该工具在精简的Linux环境中缺失,导致Win32Exception。
解决方案
步骤1:设置许可证密钥
在任何PDF渲染调用之前配置许可证密钥:
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"
$vbLabelText
$csharpLabel
试用密钥也能解决该问题。 设置有效的许可证密钥可以防止IronPDF尝试打开浏览器。
步骤2:安装xdg-utils
如果您需要在没有许可证密钥的情况下运行或想消除依赖:
sudo apt update
sudo apt install xdg-utils
sudo apt update
sudo apt install xdg-utils
SHELL
有关完整的Linux和WSL设置,请参阅Linux部署指南。
准备开始了吗?
Nuget 下载 20,088,359 | 版本: 2026.7 刚刚发布

