web.co/nfig dosyasında 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 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.
SHELL

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

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
$vbLabelText   $csharpLabel
  • using System.Co/nfiguration; yönergesi, Web.co/nfig gibi yapılandırma dosyalarına erişim sağlar.
  • ConfigurationManager.AppSettings["IronZip.LicenseKey"], appSettings bö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.
Curtis Chau
Teknik Yazar

Curtis Chau, Bilgisayar Bilimleri alanında Lisans Derecesine (Carleton Üniversitesi) sahip ve Node.js, TypeScript, JavaScript ve React konularında uzmanlaşmış ön uç geliştirmeyle ilgileniyor. Sezgisel ve estetik açıdan hoş kullanıcı arayüzleri oluşturma tutkunu, Curtis modern çerçevelerle çalışmayı ve iyi yapı...

Daha Fazla Oku
Başlamaya Hazır mısınız?
Nuget İndirmeler 21,060 | Sürüm: 2026.6 just released
Still Scrolling Icon

Hâlâ Kaydırıyor Musunuz?

Hızlıca kanıt ister misiniz? PM > Install-Package IronZip
bir örnek çalıştırın dosyalarınızı bir arşiv haline getirin.