Fehlerbehebung bei der Konfiguration der IronPrint-Lizenz

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

Das Problem wurde mit der Version 2024.3.6 von IronPrint behoben.

# This shell output shows an unhandled exception error due to missing license for IronPrint.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronPrint must be licensed for development.
# This shell output shows an unhandled exception error due to missing license for IronPrint.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronPrint must be licensed for development.
SHELL

Bei älteren IronPrint-Versionen, insbesondere solchen, die vor Version 2024.3.6 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="IronPrint.LicenseKey" value="IRONPRINT.MYLICENSE.KEY.1EF01"/>
  </appSettings>
  ...
</configuration>
<configuration>
  ...
  <appSettings>
    <add key="IronPrint.LicenseKey" value="IRONPRINT.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 IronPrint.License.LicenseKey zu übergeben.

using System;
using System.Co/nfiguration;

namespace IronPrintLicenseSetup
{
    class Program
    {
        static void Main()
        {
            // Retrieve the license key from the appSettings section of the Web.co/nfig file.
            string licenseKey = ConfigurationManager.AppSettings["IronPrint.LicenseKey"];

            // Apply the retrieved license key to the IronPrint's LicenseKey property.
            IronPrint.License.LicenseKey = licenseKey;

            // Notify user that the license key has been applied.
            Console.WriteLine("License Key has been applied successfully.");
        }
    }
}
using System;
using System.Co/nfiguration;

namespace IronPrintLicenseSetup
{
    class Program
    {
        static void Main()
        {
            // Retrieve the license key from the appSettings section of the Web.co/nfig file.
            string licenseKey = ConfigurationManager.AppSettings["IronPrint.LicenseKey"];

            // Apply the retrieved license key to the IronPrint's LicenseKey property.
            IronPrint.License.LicenseKey = licenseKey;

            // Notify user that the license key has been applied.
            Console.WriteLine("License Key has been applied successfully.");
        }
    }
}
Imports System
Imports System.Configuration

Namespace IronPrintLicenseSetup
    Class Program
        Shared Sub Main()
            ' Retrieve the license key from the appSettings section of the Web.config file.
            Dim licenseKey As String = ConfigurationManager.AppSettings("IronPrint.LicenseKey")

            ' Apply the retrieved license key to the IronPrint's LicenseKey property.
            IronPrint.License.LicenseKey = licenseKey

            ' Notify user that the license key has been applied.
            Console.WriteLine("License Key has been applied successfully.")
        End Sub
    End Class
End Namespace
$vbLabelText   $csharpLabel

Im obigen Beispiel wird ConfigurationManager.AppSettings verwendet, um den Lizenzschlüssel direkt aus Web.co/nfig abzurufen. Der Schlüssel wird dann für die IronPrint-Komponente auf LicenseKey gesetzt, um sicherzustellen, dass die Anwendung über die erforderliche Lizenz verfügt, um korrekt zu laufen.

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 41,154 | Version: 2026.5 just released
Still Scrolling Icon

Scrollst du immer noch?

Sie brauchen schnell einen Beweis? PM > Install-Package IronPrint
Führen Sie ein Beispiel aus und beobachten Sie, wie Ihr Dokument auf dem Drucker ausgegeben wird.