Configure la licencia de IronXL en web.config (C#)
El problema ha sido resuelto desde la versión de IronXL 2024.3.20.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronXL must be licensed for development.
Para las versiones anteriores de IronXL, específicamente aquellas entre las versiones 2023.4.13 y 2024.3.20, existe un problema conocido de licenciamiento en:
- Proyectos ASP.NET
- Versión de .NET Framework >= 4.6.2
La clave almacenada en un archivo Web.config NO será detectada ni utilizada por el producto.
Solución alternativa
Para abordar este problema, se recomienda recuperar la clave de licencia del archivo Web.config utilizando ConfigurationManager en el código, y luego aplicarla a la propiedad License.LicenseKey.
Ejemplo:
A continuación se muestra un ejemplo de cómo almacenar la clave de licencia en un archivo 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>
Con la configuración del archivo XML anterior, podemos usar ConfigurationManager para recuperar el valor de la clave de licencia y establecerlo en la propiedad 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
Dim licenseKey As String = ConfigurationManager.AppSettings("IronXl.LicenseKey")
' Apply the retrieved license key to the IronXL component
IronXl.License.LicenseKey = licenseKey
En este ejemplo, se utiliza el ConfigurationManager.AppSettings para recuperar el valor de IronXl.LicenseKey de Web.config. La clave de licencia recuperada se establece a continuación en el IronXl.License.LicenseKey para asegurar que los componentes de IronXL puedan funcionar correctamente.

