Configuração de Licença do IronBarcode em web.config
Este problema foi resolvido na versão 2024.3.2 do IronBarcode.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronBarcode must be licensed for development.
Para versões mais antigas do IronBarcode, especificamente aquelas entre as versões 2023.4.1 e 2024.3.2, existe um problema conhecido de licenciamento em:
- Projetos ASP.NET
- Versão do .NET Framework >= 4.6.2
A chave armazenada em um arquivo Web.config NÃO será capturada e usada pelo produto.
Solução alternativa
Para resolver este problema, é recomendado recuperar a chave de licença do arquivo Web.config usando ConfigurationManager no código, e depois aplicá-la à propriedade License.LicenseKey.
Exemplo:
<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>
Com o arquivo XML fornecido acima, podemos usar ConfigurationManager para recuperar o valor da chave de licença e passá-lo para a propriedade 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

