web.config'te IronOCR Lisans Kurulumu
Sorun, IronZIP sürümü 2024.3.3 itibariyle çözüldü.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronZip must be licensed for development.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronZip must be licensed for development.
2024.3.3 sürümünden önce yayınlanan daha eski IronZip sürümleri için bilinen bir lisans sorunu vardır:
- ASP.NET projeleri
- .NET Framework sürümü >= 4.6.2
Anahtar, bir Web.config dosyasında saklandığında, ürün tarafından KESİNLİKLE alınmayacak ve kullanılmayacaktır.
Geçici Çözüm
Bu sorunu ele almak için, lisans anahtarını kodda ConfigurationManager kullanarak Web.config dosyasından alınması ve daha sonra License.LicenseKey özelliğine uygulanması ö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 lisans anahtarı değerini ConfigurationManager kullanarak alabilir ve IronZip.License.LicenseKey özelliğine iletebiliriz.
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
using System.Configuration;yönergesi,Web.configgibi yapılandırma dosyalarına erişime izin verir.ConfigurationManager.AppSettings["IronZip.LicenseKey"],Web.config'unappSettingsbölümüne saklanan lisans anahtarını alır.IronZip.License.LicenseKey = licenseKey;, lisanslama istisnalarını önlemek için alınan anahtarı IronZip kütüphanesine atar.Console.WriteLine()ifadesi, geliştiriciye lisans anahtarı uygulama işleminin başarıyla tamamlandığına dair geri bildirim sağlar.

