IronPrint License Configuration Troubleshooting

This article was translated from English: Does it need improvement?
Translated
View the article in English

2024.3.6 起,該問題已解決

# This shell output shows an unhandled exception error due to missing license for IronPrint.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronPrint must be licensed for development.
# This shell output shows an unhandled exception error due to missing license for IronPrint.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronPrint must be licensed for development.
SHELL

對於較舊的 IronPrint 版本,特別是在 2024.3.6 版之前發行的版本,存在一個已知的授權問題:

  • ASP.NET專案
  • .NET Framework 版本 >= 4.6.2

儲存於 Web.config 檔案中的金鑰將不會被產品擷取和使用。

工作方法

範例: ... ... ``` 有了上面提供的 XML 檔案,我們就可以使用 **ConfigurationManager** 擷取授權金鑰值,並將其傳給 **IronPrint.License.LicenseKey** 屬性。 ```csharp using System; using System.Configuration; namespace IronPrintLicenseSetup { class Program { static void Main() { // Retrieve the license key from the appSettings section of the Web.config file. string licenseKey = ConfigurationManager.AppSettings["IronPrint.LicenseKey"]; // Apply the retrieved license key to the IronPrint's LicenseKey property. IronPrint.License.LicenseKey = licenseKey; // Notify user that the license key has been applied. Console.WriteLine("License Key has been applied successfully."); } } } ``` 在上面的範例中,`ConfigurationManager.AppSettings` 用來直接從 `Web.config` 取得授權金鑰。 然後,該金鑰會被設定為 IronPrint 元件的 `LicenseKey` ,以確保應用程式擁有正確執行所需的授權。
Curtis Chau
技術作家

Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。

除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。

準備好開始了嗎?
Nuget 下載 34,016 | 版本: 2025.11 剛剛發布