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 剛剛發布

