Chave de licença do IronWord na configuração do ASP.NET
O problema foi resolvido a partir da versão 2024.3.5 do IronWord .
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronWord must be licensed for development.
Para versões mais antigas do IronWord , especificamente aquelas lançadas antes da versão 2024.3.5 , 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á 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="IronWord.LicenseKey" value="IRONWORD.MYLICENSE.KEY.1EF01"/>
</appSettings>
...
</configuration>
<configuration>
...
<appSettings>
<add key="IronWord.LicenseKey" value="IRONWORD.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 IronWord .
// Import the necessary namespace for ConfigurationManager
using System.Configuration;
// Retrieve the license key from the AppSettings in Web.config
string licenseKey = ConfigurationManager.AppSettings["IronWord.LicenseKey"];
// Set the license key for IronWord
IronWord.License.LicenseKey = licenseKey;
// Import the necessary namespace for ConfigurationManager
using System.Configuration;
// Retrieve the license key from the AppSettings in Web.config
string licenseKey = ConfigurationManager.AppSettings["IronWord.LicenseKey"];
// Set the license key for IronWord
IronWord.License.LicenseKey = licenseKey;
' Import the necessary namespace for ConfigurationManager
Imports System.Configuration
' Retrieve the license key from the AppSettings in Web.config
Private licenseKey As String = ConfigurationManager.AppSettings("IronWord.LicenseKey")
' Set the license key for IronWord
IronWord.License.LicenseKey = licenseKey

