Clave de licencia de IronWord en la configuración de ASP.NET
El problema se ha resuelto a partir de la versión 2024.3.5 de IronWord .
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronWord must be licensed for development.
Para versiones antiguas de IronWord, específicamente aquellas lanzadas antes de la versión 2024.3.5, existe un problema conocido de licencia 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 aplicarla a la propiedad License.LicenseKey.
Ejemplo:
<configuration>
...
<appSettings>
<add key="IronWord.LicenseKey" value="IRONWORD.MYLICENSE.KEY.1EF01"/>
</appSettings>
...
</configuration>
<configuration>
...
<appSettings>
<add key="IronWord.LicenseKey" value="IRONWORD.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 IronWord.License.LicenseKey.
// Import the necessary namespace for ConfigurationManager
using System.Configuration;
// Retrieve the license key from the AppSettings in Web.config
string licenseKey = ConfigurationManager.AppSettings["IronWord.LicenseKey"];
// Set the license key for IronWord
IronWord.License.LicenseKey = licenseKey;
// Import the necessary namespace for ConfigurationManager
using System.Configuration;
// Retrieve the license key from the AppSettings in Web.config
string licenseKey = ConfigurationManager.AppSettings["IronWord.LicenseKey"];
// Set the license key for IronWord
IronWord.License.LicenseKey = licenseKey;
' Import the necessary namespace for ConfigurationManager
Imports System.Configuration
' Retrieve the license key from the AppSettings in Web.config
Private licenseKey As String = ConfigurationManager.AppSettings("IronWord.LicenseKey")
' Set the license key for IronWord
IronWord.License.LicenseKey = licenseKey

