Definindo a chave de licença no arquivo Web.config.

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

O problema foi resolvido na versão IronQR 2024.3.2.

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 , 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á captada e utilizada pelo produto.

Solução alternativa

Para resolver este problema, recomenda-se recuperar a chave de licença do arquivo Web.config usando ConfigurationManager no código, e então aplicá-la à propriedade License.LicenseKey.

Exemplo:

<configuration>
  ...
  <appSettings>
    <add key="IronQr.LicenseKey" value="IronQR-MYLICENSE-KEY-1EF01"/>
  </appSettings>
  ...
</configuration>
<configuration>
  ...
  <appSettings>
    <add key="IronQr.LicenseKey" value="IronQR-MYLICENSE-KEY-1EF01"/>
  </appSettings>
  ...
</configuration>
XML

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;
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;
$vbLabelText   $csharpLabel
Curtis Chau
Redator Técnico

Curtis 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 ...

Leia mais
Pronto para começar?
Nuget Downloads 61,359 | Versão: 2026.3 acaba de ser lançado
Still Scrolling Icon

Ainda está rolando a tela?

Quer provas rápidas? PM > Install-Package IronQR
executar um exemplo Veja seu URL se transformar em um código QR.