Configure IronXL License in web.config (C#)

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

Le problème a été résolu à partir de la version 2024.3.20 IronXL .

Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronXL must be licensed for development.

Pour les anciennes versions d'IronXL, notamment celles comprises entre les versions 2023.4.13 et 2024.3.20 , il existe un problème de licence connu :

  • projets ASP.NET
  • version .NET Framework >= 4.6.2

La clé stockée dans un fichier Web.config ne sera PAS récupérée et utilisée par le produit.

Solution de contournement

Pour résoudre ce problème, il est recommandé de récupérer la clé de licence à partir du fichier Web.config en utilisant ConfigurationManager dans le code, puis de l'appliquer à la propriété License.LicenseKey.

Exemple :

Voici un exemple de la manière de stocker la clé de licence dans un fichier 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

Avec la configuration de fichier XML ci-dessus, nous pouvons utiliser ConfigurationManager pour récupérer la valeur de la clé de licence et la définir sur la propriété 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

Dans cet exemple, le ConfigurationManager.AppSettings est utilisé pour récupérer la valeur de IronXl.LicenseKey à partir de Web.config. La clé de licence récupérée est ensuite définie sur IronXl.License.LicenseKey pour garantir que les composants IronXL puissent fonctionner correctement.

Curtis Chau
Rédacteur technique

Curtis Chau détient un baccalauréat en informatique (Université de Carleton) et se spécialise dans le développement front-end avec expertise en Node.js, TypeScript, JavaScript et React. Passionné par la création d'interfaces utilisateur intuitives et esthétiquement plaisantes, Curtis aime travailler avec des frameworks modernes ...

Lire la suite

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

Prêt à commencer?
Nuget Téléchargements 1,890,100 | Version : 2026.3 vient de sortir

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

Vous faites encore défiler ?

Vous voulez une preuve rapidement ? PM > Install-Package IronXl.Excel
exécuter un échantillon regarder vos données devenir une feuille de calcul.