web.co/nfig dosyasında IronOCR Lisans Kurulumu
Sorun, IronZip sürüm 2024.3.3 ile çözülmüştür.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronZip must be licensed for development.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronZip must be licensed for development.
Eski IronZip sürümlerinde, özellikle 2024.3.3 sürümünden önce yayınlananlarda, şu lisans sorunu bilinmektedir:
- ASP.NET projeleri
- .NET Framework sürümü >= 4.6.2
Web.co/nfig dosyasında depolanan anahtar, ürün tarafından ALINMAYACAK ve KULLANILMAYACAKTIR.
Çözüm
Bu sorunu çözmek için, koddaki ConfigurationManager'ı kullanarak Web.co/nfig dosyasından lisans anahtarını almanız ve ardından bunu License.LicenseKey özelliğine uygulamanız önerilir.
Örnek:
<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>
Yukarıda sağlanan XML dosyası ile ConfigurationManager'ı kullanarak lisans anahtarı değerini alabilir ve bunu IronZip.License.LicenseKey özelliğine aktarabiliriz.
using System;
using System.Co/nfiguration;
class Program
{
static void Main()
{
// Retrieve the license key from the web.co/nfig 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.Co/nfiguration;
class Program
{
static void Main()
{
// Retrieve the license key from the web.co/nfig 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
Module Program
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 Module
using System.Co/nfiguration;yönergesi,Web.co/nfiggibi yapılandırma dosyalarına erişim sağlar.ConfigurationManager.AppSettings["IronZip.LicenseKey"],appSettingsbölümünde depolanan lisans anahtarınıWeb.co/nfig'den alır.IronZip.License.LicenseKey = licenseKey;, lisans istisnalarını önlemek için alınan anahtarı IronZIP kütüphanesine atar.Console.WriteLine()ifadesi, lisans anahtarı başvuru sürecinin başarıyla tamamlandığını geliştiriciye bildirir.

