Configuração da licença do IronOCR no arquivo web.config.
O problema foi resolvido a partir da versão 2024.3.3 do IronZIP .
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronZip must be licensed for development.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronZip must be licensed for development.
Para versões antigas do IronZIP, especificamente aquelas lançadas antes da versão 2024.3.3, 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á detectada e usada pelo produto.
Solução alternativa
Para resolver esse problema, recomenda-se recuperar a chave de licença do arquivo Web.config usando o ConfigurationManager no código e, em seguida, aplicá-la à propriedade License.LicenseKey.
Exemplo:
<configuration>
...
<appSettings>
<add key="IronZip.LicenseKey" value="IRONZIP.MYLICENSE.KEY.1EF01"/>
</appSettings>
...
</configuration>
<configuration>
...
<appSettings>
<add key="IronZip.LicenseKey" value="IRONZIP.MYLICENSE.KEY.1EF01"/>
</appSettings>
...
</configuration>
Com o arquivo XML fornecido acima, podemos usar o ConfigurationManager para recuperar o valor da chave de licença e passá-lo para a propriedade IronZIP .
using System;
using System.Configuration;
class Program
{
static void Main()
{
// Retrieve the license key from the web.config appSettings
string licenseKey = ConfigurationManager.AppSettings["IronZip.LicenseKey"];
// Apply the license key to IronZip
IronZip.License.LicenseKey = licenseKey;
// Verify that the license key is set properly
Console.WriteLine("License key applied successfully.");
}
}
using System;
using System.Configuration;
class Program
{
static void Main()
{
// Retrieve the license key from the web.config appSettings
string licenseKey = ConfigurationManager.AppSettings["IronZip.LicenseKey"];
// Apply the license key to IronZip
IronZip.License.LicenseKey = licenseKey;
// Verify that the license key is set properly
Console.WriteLine("License key applied successfully.");
}
}
Imports System
Imports System.Configuration
Friend Class Program
Shared Sub Main()
' Retrieve the license key from the web.config appSettings
Dim licenseKey As String = ConfigurationManager.AppSettings("IronZip.LicenseKey")
' Apply the license key to IronZip
IronZip.License.LicenseKey = licenseKey
' Verify that the license key is set properly
Console.WriteLine("License key applied successfully.")
End Sub
End Class
- A diretiva
using System.Configuration;permite o acesso a arquivos de configuração, comoWeb.config. ConfigurationManager.AppSettings["IronZip.LicenseKey"]recupera a chave de licença armazenada na seçãoappSettingsdeWeb.config.IronZip.License.LicenseKey = licenseKey;atribui a chave recuperada à biblioteca IronZIP para evitar exceções de licenciamento.- A declaração
Console.WriteLine()fornece feedback ao desenvolvedor de que o processo de solicitação da chave de licença foi concluído com sucesso.

