Configuración de la licencia de IronOCR en web.config
El problema se ha resuelto a partir de la versión 2024.3.3 de IronZIP .
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronZip must be licensed for development.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronZip must be licensed for development.
Para versiones más antiguas de IronZIP, específicamente aquellas lanzadas antes de la versión 2024.3.3, existe un problema conocido de licencias en:
- Proyectos ASP.NET
- Versión de .NET Framework >= 4.6.2
La clave almacenada en un archivo Web.config NO será recogida ni utilizada por el producto.
Solución alternativa
Para solucionar este problema, se recomienda recuperar la clave de licencia del archivo Web.config usando ConfigurationManager en el código y luego aplicarlo a la propiedad License.LicenseKey.
Ejemplo:
<configuration>
...
<appSettings>
<add key="IronZip.LicenseKey" value="IRONZIP.MYLICENSE.KEY.1EF01"/>
</appSettings>
...
</configuration>
<configuration>
...
<appSettings>
<add key="IronZip.LicenseKey" value="IRONZIP.MYLICENSE.KEY.1EF01"/>
</appSettings>
...
</configuration>
Con el archivo XML proporcionado arriba, podemos usar ConfigurationManager para recuperar el valor de la clave de licencia y pasarla a la propiedad IronZip.License.LicenseKey.
using System;
using System.Configuration;
class Program
{
static void Main()
{
// Retrieve the license key from the web.config appSettings
string licenseKey = ConfigurationManager.AppSettings["IronZip.LicenseKey"];
// Apply the license key to IronZip
IronZip.License.LicenseKey = licenseKey;
// Verify that the license key is set properly
Console.WriteLine("License key applied successfully.");
}
}
using System;
using System.Configuration;
class Program
{
static void Main()
{
// Retrieve the license key from the web.config appSettings
string licenseKey = ConfigurationManager.AppSettings["IronZip.LicenseKey"];
// Apply the license key to IronZip
IronZip.License.LicenseKey = licenseKey;
// Verify that the license key is set properly
Console.WriteLine("License key applied successfully.");
}
}
Imports System
Imports System.Configuration
Friend Class Program
Shared Sub Main()
' Retrieve the license key from the web.config appSettings
Dim licenseKey As String = ConfigurationManager.AppSettings("IronZip.LicenseKey")
' Apply the license key to IronZip
IronZip.License.LicenseKey = licenseKey
' Verify that the license key is set properly
Console.WriteLine("License key applied successfully.")
End Sub
End Class
- La directiva
using System.Configuration;permite el acceso a archivos de configuración, comoWeb.config. ConfigurationManager.AppSettings["IronZip.LicenseKey"]recupera la clave de licencia almacenada en la secciónappSettingsdeWeb.config.IronZip.License.LicenseKey = licenseKey;asigna la clave recuperada a la biblioteca IronZIP para evitar excepciones de licencia.- La declaración
Console.WriteLine()proporciona retroalimentación al desarrollador de que el proceso de solicitud de clave de licencia se completó exitosamente.

