Configuración de la licencia de IronBarcode en web.config
Este problema se ha resuelto en la versión 2024.3.2 de IronBarcode.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronBarcode must be licensed for development.
Para versiones más antiguas de IronBarcode, específicamente aquellas entre las versiones 2023.4.1 y 2024.3.2, hay un problema de licencia conocido en:
- Proyectos ASP.NET
- Versión de .NET Framework >= 4.6.2
La clave almacenada en un archivo Web.config NO será recogida y utilizada por el producto.
Solución alternativa
Para abordar este problema, se recomienda recuperar la clave de licencia desde el archivo Web.config usando ConfigurationManager en el código, y luego aplicarla a la propiedad License.LicenseKey.
Ejemplo:
<configuration>
...
<appSettings>
<add key="IronBarCode.LicenseKey" value="IRONBARCODE-MYLICENSE-KEY-1EF01"/>
</appSettings>
...
</configuration>
<configuration>
...
<appSettings>
<add key="IronBarCode.LicenseKey" value="IRONBARCODE-MYLICENSE-KEY-1EF01"/>
</appSettings>
...
</configuration>
Con el archivo XML proporcionado anteriormente, podemos usar ConfigurationManager para recuperar el valor de la clave de licencia y pasarlo a la propiedad IronBarCode.License.LicenseKey.
using System.Configuration;
// Retrieve the license key from appSettings in the Web.config file
string licenseKey = ConfigurationManager.AppSettings["IronBarCode.LicenseKey"];
// Apply the retrieved license key to the IronBarCode LicenseKey property
IronBarCode.License.LicenseKey = licenseKey;
using System.Configuration;
// Retrieve the license key from appSettings in the Web.config file
string licenseKey = ConfigurationManager.AppSettings["IronBarCode.LicenseKey"];
// Apply the retrieved license key to the IronBarCode LicenseKey property
IronBarCode.License.LicenseKey = licenseKey;
Imports System.Configuration
' Retrieve the license key from appSettings in the Web.config file
Private licenseKey As String = ConfigurationManager.AppSettings("IronBarCode.LicenseKey")
' Apply the retrieved license key to the IronBarCode LicenseKey property
IronBarCode.License.LicenseKey = licenseKey

