Configure IronXL License in web.config (C#)

This article was translated from English: Does it need improvement?
Translated
View the article in English

El problema se ha resuelto a partir de la versión 2024.3.20 de IronXL .

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á 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:

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>
XML

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;
$vbLabelText   $csharpLabel

En este ejemplo, se utiliza ConfigurationManager.AppSettings para recuperar el valor de IronXl.LicenseKey de Web.config. Luego, la clave de licencia recuperada se establece en IronXl.License.LicenseKey para garantizar que los componentes IronXL puedan funcionar correctamente.

Curtis Chau
Escritor Técnico

Curtis Chau tiene una licenciatura en Ciencias de la Computación (Carleton University) y se especializa en el desarrollo front-end con experiencia en Node.js, TypeScript, JavaScript y React. Apasionado por crear interfaces de usuario intuitivas y estéticamente agradables, disfruta trabajando con frameworks modernos y creando manuales bien ...

Leer más

A PHP Error was encountered

Severity: Notice

Message: Undefined index: IronXl.Excel

Filename: helpers/counter_helper.php

Line Number: 85

Backtrace:

File: /var/www/ironpdf.com/application/helpers/counter_helper.php
Line: 85
Function: _error_handler

File: /var/www/ironpdf.com/application/views/main/sections/ready_to_started_202509.php
Line: 12
Function: getTotalDonwloadNumber

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 489
Function: view

File: /var/www/ironpdf.com/application/controllers/Products/Troubleshooting.php
Line: 27
Function: render_products_view

File: /var/www/ironpdf.com/index.php
Line: 292
Function: require_once

A PHP Error was encountered

Severity: Notice

Message: Undefined index: IronXl.Excel

Filename: helpers/counter_helper.php

Line Number: 85

Backtrace:

File: /var/www/ironpdf.com/application/helpers/counter_helper.php
Line: 85
Function: _error_handler

File: /var/www/ironpdf.com/application/views/main/sections/ready_to_started_202509.php
Line: 19
Function: getTotalDonwloadNumber

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 489
Function: view

File: /var/www/ironpdf.com/application/controllers/Products/Troubleshooting.php
Line: 27
Function: render_products_view

File: /var/www/ironpdf.com/index.php
Line: 292
Function: require_once

¿Listo para empezar?
Nuget Descargas 1,890,100 | Versión: 2026.3 recién lanzado

A PHP Error was encountered

Severity: Notice

Message: Undefined index: IronXl.Excel

Filename: helpers/counter_helper.php

Line Number: 85

Backtrace:

File: /var/www/ironpdf.com/application/helpers/counter_helper.php
Line: 85
Function: _error_handler

File: /var/www/ironpdf.com/application/views/main/sections/still_scrolling_202512.php
Line: 17
Function: getTotalDonwloadNumber

File: /var/www/ironpdf.com/application/views/products/sections/three_column_docs_page_structure.php
Line: 71
Function: view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 88
Function: view

File: /var/www/ironpdf.com/application/views/products/troubleshooting/index.php
Line: 2
Function: view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 88
Function: view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 552
Function: view

File: /var/www/ironpdf.com/application/controllers/Products/Troubleshooting.php
Line: 27
Function: render_products_view

File: /var/www/ironpdf.com/index.php
Line: 292
Function: require_once

A PHP Error was encountered

Severity: Notice

Message: Undefined index: IronXl.Excel

Filename: helpers/counter_helper.php

Line Number: 85

Backtrace:

File: /var/www/ironpdf.com/application/helpers/counter_helper.php
Line: 85
Function: _error_handler

File: /var/www/ironpdf.com/application/views/main/sections/still_scrolling_202512.php
Line: 24
Function: getTotalDonwloadNumber

File: /var/www/ironpdf.com/application/views/products/sections/three_column_docs_page_structure.php
Line: 71
Function: view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 88
Function: view

File: /var/www/ironpdf.com/application/views/products/troubleshooting/index.php
Line: 2
Function: view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 88
Function: view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 552
Function: view

File: /var/www/ironpdf.com/application/controllers/Products/Troubleshooting.php
Line: 27
Function: render_products_view

File: /var/www/ironpdf.com/index.php
Line: 292
Function: require_once

Still Scrolling Icon

¿Aún desplazándote?

¿Quieres una prueba rápida? PM > Install-Package IronXl.Excel
ejecuta una muestra observa cómo tus datos se convierten en una hoja de cálculo.