Web.config Dosyasında Lisans Anahtarını Ayarlama

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

Bu sorun, IronOCR sürüm 2024.3.4 itibariyle çözüldü.

Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronOCR must be licensed for development.

Older IronOcr sürümleri, özellikle 2023.4.13 ile 2024.3.4 arasındaki sürümler için, şu bilinen bir lisanslama sorunu vardır:

  • ASP.NET projeleri
  • .NET Framework sürümü >= 4.6.2

Bir Web.config dosyasına kaydedilen anahtar ürün tarafından KULLANILMAZ.

Geçici Çözüm

Bu sorunu çözmek için, kod içinde ConfigurationManager kullanarak Web.config dosyasından lisans anahtarını almak ve ardından License.LicenseKey özelliğine uygulamak önerilir.

Örnek:

<configuration>
  ...
  <appSettings>
    <add key="IronOcr.LicenseKey" value="IRONOCR-MYLICENSE-KEY-1EF01"/>
  </appSettings>
  ...
</configuration>
<configuration>
  ...
  <appSettings>
    <add key="IronOcr.LicenseKey" value="IRONOCR-MYLICENSE-KEY-1EF01"/>
  </appSettings>
  ...
</configuration>
XML

Yukarıda sağlanan XML dosyası ile, lisans anahtar değerini almak ve IronOcr.License.LicenseKey özelliğine iletmek için ConfigurationManager kullanabiliriz.

using System.Configuration;

// Retrieve the license key from the Web.config's appSettings
string licenseKey = ConfigurationManager.AppSettings["IronOcr.LicenseKey"];

// Apply the license key to IronOcr to avoid licensing exceptions
IronOcr.License.LicenseKey = licenseKey;
using System.Configuration;

// Retrieve the license key from the Web.config's appSettings
string licenseKey = ConfigurationManager.AppSettings["IronOcr.LicenseKey"];

// Apply the license key to IronOcr to avoid licensing exceptions
IronOcr.License.LicenseKey = licenseKey;
Imports System.Configuration

' Retrieve the license key from the Web.config's appSettings
Private licenseKey As String = ConfigurationManager.AppSettings("IronOcr.LicenseKey")

' Apply the license key to IronOcr to avoid licensing exceptions
IronOcr.License.LicenseKey = licenseKey
$vbLabelText   $csharpLabel
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 5,585,834 | Sürüm: 2026.4 just released
Still Scrolling Icon

Hala Kaydiriyor musunuz?

Hızlı bir kanit mi istiyorsunuz? PM > Install-Package IronOcr
örnekleri çalıştır resminizin aranabilir metne donuşünü izleyin.