Festlegen des Lizenzschlüssels in Web.co/nfig

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

Das Problem wurde mit der Version 2024.3.2 von IronQR behoben.

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

Bei älteren IronQR-Versionen, insbesondere solchen, die vor Version 2024.3.2 veröffentlicht wurden, gibt es ein bekanntes Lizenzproblem in:

  • ASP.NET-Projekte
  • .NET Framework Version >= 4.6.2

Der in einer Web.co/nfig-Datei gespeicherte Schlüssel wird vom Produkt NICHT erfasst und verwendet.

Workaround

Um dieses Problem zu beheben, wird empfohlen, den Lizenzschlüssel mithilfe von ConfigurationManager im Code aus der Datei Web.co/nfig abzurufen und ihn dann auf die Eigenschaft License.LicenseKey anzuwenden.

Beispiel:

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

Mit der oben bereitgestellten XML-Datei können wir den ConfigurationManager verwenden, um den Wert des Lizenzschlüssels abzurufen und ihn an die Eigenschaft IronQr.License.LicenseKey zu übergeben.

using System.Co/nfiguration;

// Retrieve the license key from the Web.co/nfig file's appSettings section
string licenseKey = ConfigurationManager.AppSettings["IronQr.LicenseKey"];

// Apply the retrieved license key to the IronQR LicenseKey property
IronQr.License.LicenseKey = licenseKey;
using System.Co/nfiguration;

// Retrieve the license key from the Web.co/nfig file's appSettings section
string licenseKey = ConfigurationManager.AppSettings["IronQr.LicenseKey"];

// Apply the retrieved license key to the IronQR LicenseKey property
IronQr.License.LicenseKey = licenseKey;
Imports System.Configuration

' Retrieve the license key from the Web.config file's appSettings section
Dim licenseKey As String = ConfigurationManager.AppSettings("IronQr.LicenseKey")

' Apply the retrieved license key to the IronQR LicenseKey property
IronQr.License.LicenseKey = licenseKey
$vbLabelText   $csharpLabel
Curtis Chau
Technischer Autor

Curtis Chau hat einen Bachelor-Abschluss in Informatik von der Carleton University und ist spezialisiert auf Frontend-Entwicklung mit Expertise in Node.js, TypeScript, JavaScript und React. Leidenschaftlich widmet er sich der Erstellung intuitiver und ästhetisch ansprechender Benutzerschnittstellen und arbeitet gerne mit modernen Frameworks sowie der Erstellung gut strukturierter, optisch ansprechender ...

Weiterlesen
Bereit anzufangen?
Nuget Downloads 67,270 | Version: 2026.5 just released
Still Scrolling Icon

Scrollst du immer noch?

Sie brauchen schnell einen Beweis? PM > Install-Package IronQR
Führen Sie ein Beispiel aus und beobachten Sie, wie Ihre URL zu einem QR-Code wird.