web.config'te IronOCR Lisans Kurulumu

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

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

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>
XML

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
$vbLabelText   $csharpLabel
  • using System.Configuration; yönergesi, Web.config gibi yapılandırma dosyalarına erişime izin verir.
  • ConfigurationManager.AppSettings["IronZip.LicenseKey"], Web.config'un appSettings bö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.
Curtis Chau
Teknik Yazar

Curtis Chau, Bilgisayar Bilimleri alanında lisans derecesine sahiptir (Carleton Üniversitesi) ve Node.js, TypeScript, JavaScript ve React konularında uzmanlaşmış ön uç geliştirme üzerine uzmanlaşmıştır. Kullanıcı dostu ve estetik açıdan hoş arayüzler tasarlamaya tutkuyla bağlı olan Curtis, modern çerç...

Daha Fazlasını Oku
Başlamaya Hazır mısınız?
Nuget İndirmeler 19,717 | Sürüm: 2026.4 just released
Still Scrolling Icon

Hala Kaydiriyor musunuz?

Hızlı bir kanit mi istiyorsunuz? PM > Install-Package IronZip
bir örnek çalıştırın dosyalarınızın bir arşiv haline gelmesini izleyin.