IronXL 故障排除 在 Web.config 中设置许可密钥 Configure IronXL License in web.config (C#) Curtis Chau 更新日期:6月 9, 2025 Download IronXL NuGet 下載 DLL 下載 Start Free Trial Copy for LLMs Copy for LLMs Copy page as Markdown for LLMs Open in ChatGPT Ask ChatGPT about this page Open in Gemini Ask Gemini about this page Open in Grok Ask Grok about this page Open in Perplexity Ask Perplexity about this page Share Share on Facebook Share on X (Twitter) Share on LinkedIn Copy URL Email article This article was translated from English: Does it need improvement? Translated View the article in English 問題已在 IronXL 版本 2024.3.20 中解決。 Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronXL must be licensed for development. For older IronXL versions, specifically those between versions 2023.4.13 and 2024.3.20, there is a known licensing issue in: ASP.NET 項目 .NET Framework 版本 >= 4.6.2 存儲在 Web.config 文件中的密鑰不會被產品識別和使用。 解決方法 為了解決此問題,建議在代碼中使用 ConfigurationManager 從 Web.config 文件中提取 License Key,然後將其應用於 License.LicenseKey 屬性。 範例: 以下是一個如何在 Web.config 文件中存儲許可密鑰的示例: <configuration> ... <appSettings> <add key="IronXL.LicenseKey" value="IronXL-MYLICENSE-KEY-1EF01"/> </appSettings> ... </configuration> <configuration> ... <appSettings> <add key="IronXL.LicenseKey" value="IronXL-MYLICENSE-KEY-1EF01"/> </appSettings> ... </configuration> XML 通過上述 XML 文件設置,我們可以使用 ConfigurationManager 檢索許可密鑰值並將其設置為 IronXL.License.LicenseKey 屬性: using System.Configuration; // Retrieve the license key from the Web.config appSettings section string licenseKey = ConfigurationManager.AppSettings["IronXL.LicenseKey"]; // Apply the retrieved license key to the IronXL component IronXL.License.LicenseKey = licenseKey; using System.Configuration; // Retrieve the license key from the Web.config appSettings section string licenseKey = ConfigurationManager.AppSettings["IronXL.LicenseKey"]; // Apply the retrieved license key to the IronXL component IronXL.License.LicenseKey = licenseKey; Imports System.Configuration ' Retrieve the license key from the Web.config appSettings section Private licenseKey As String = ConfigurationManager.AppSettings("IronXL.LicenseKey") ' Apply the retrieved license key to the IronXL component IronXL.License.LicenseKey = licenseKey $vbLabelText $csharpLabel 在此示例中,ConfigurationManager.AppSettings 用於從 Web.config 中獲取 IronXL.LicenseKey 的值。 然後將檢索到的許可密鑰設置為 IronXL.License.LicenseKey 以確保 IronXL 組件能夠正常運行。 Curtis Chau 立即與工程團隊聊天 技術作家 Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。 準備好開始了嗎? Nuget 下載 1,686,155 | 版本: 2025.11 剛剛發布 免費 NuGet 下載 總下載量:1,686,155 查看許可證