IronXL Lizenzschlüssel in web.config konfigurieren: Excel Tabelle erstellen ohne Fehler (C#)
Das Problem wurde mit IronXL Version 2024.3.20 behoben .
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronXL must be licensed for development.
Für ältere IronXL-Versionen, insbesondere jene zwischen den Versionen 2023.4.13 und 2024.3.20, gibt es ein bekanntes Lizenzierungsproblem in:
- ASP.NET-Projekten
- .NET Framework Version >= 4.6.2
Der in einer Web.config Datei gespeicherte Schlüssel wird vom Produkt NICHT erkannt und verwendet.
Problemumgehung
Um dieses Problem zu beheben, wird empfohlen, den Lizenzschlüssel aus der Datei Web.config mithilfe des ConfigurationManager im Code abzurufen und ihn dann auf die Eigenschaft License.LicenseKey anzuwenden.
Beispiel:
Nachfolgend ein Beispiel, wie der Lizenzschlüssel in einer Web.config-Datei gespeichert werden kann:
<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>
Mit der oben beschriebenen XML-Datei-Konfiguration können wir den ConfigurationManager verwenden, um den Lizenzschlüsselwert abzurufen und ihn der Eigenschaft IronXL.License.LicenseKey zuzuweisen:
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
In diesem Beispiel wird ConfigurationManager.AppSettings verwendet, um den Wert von IronXL.LicenseKey aus Web.config abzurufen. Der abgerufene Lizenzschlüssel wird dann auf IronXL.License.LicenseKey gesetzt, um sicherzustellen, dass die IronXL Komponenten ordnungsgemäß funktionieren.

