Definindo a chave de licença no arquivo Web.config.
O problema foi resolvido a partir da versão 2024.3.2 do IronQR.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronQR must be licensed for development.
Para versões mais antigas do IronQR, especificamente aquelas lançadas antes da versão 2024.3.2, há um problema de licenciamento conhecido em:
- Projetos ASP.NET
- Versão do .NET Framework >= 4.6.2
A chave armazenada em um arquivo Web.config NÃO será identificada 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, em seguida, aplicá-la à propriedade License.LicenseKey.
Exemplo:
<configuration>
...
<appSettings>
<add key="IronQR.LicenseKey" value="IronQR-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 IronQr.License.LicenseKey.
using System.Configuration;
// Retrieve the license key from the Web.config file's appSettings section
string licenseKey = ConfigurationManager.AppSettings["IronQR.LicenseKey"];
// Apply the retrieved license key to the IronQR LicenseKey property
IronQr.License.LicenseKey = licenseKey;Imports System.Configuration
' Retrieve the license key from the Web.config file's appSettings section
Dim licenseKey As String = ConfigurationManager.AppSettings("IronQR.LicenseKey")
' Apply the retrieved license key to the IronQR LicenseKey property
IronQr.License.LicenseKey = licenseKeyImports System.Configuration
' Retrieve the license key from the Web.config file's appSettings section
Dim licenseKey As String = ConfigurationManager.AppSettings("IronQR.LicenseKey")
' Apply the retrieved license key to the IronQR LicenseKey property
IronQr.License.LicenseKey = licenseKeyCurtis Chau é bacharel em Ciência da Computação (Universidade Carleton) e se especializa em desenvolvimento front-end, com experiência em Node.js, TypeScript, JavaScript e React. Apaixonado por criar interfaces de usuário intuitivas e esteticamente agradáveis, Curtis gosta de trabalhar com frameworks modernos e criar manuais bem estruturados e visualmente atraentes.