Rozwiązywanie problemów z konfiguracją licencji IronPrint

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

Problem został rozwiązany w wersji IronPrint 2024.3.6.

# 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

W przypadku starszych wersji IronPrint, a konkretnie tych wydanych przed wersją 2024.3.6, występuje znany problem z licencjonowaniem w:

  • Projekty ASP.NET
  • .NET Framework w wersji >= 4.6.2

Klucz zapisany w pliku Web.co/nfig NIE zostanie pobrany i wykorzystany przez produkt.

Rozwiązanie

Aby rozwiązać ten problem, zaleca się pobranie klucza licencyjnego z pliku Web.co/nfig za pomocą ConfigurationManager w kodzie, a następnie zastosowanie go do właściwości License.LicenseKey.

Przykład:

<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

Korzystając z pliku XML podanego powyżej, możemy użyć ConfigurationManager do pobrania wartości klucza licencyjnego i przekazania go do właściwości IronPrint.License.LicenseKey.

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

W powyższym przykładzie ConfigurationManager.AppSettings służy do pobrania klucza licencyjnego bezpośrednio z Web.co/nfig. Klucz jest następnie ustawiany jako LicenseKey dla komponentu IronPrint, co gwarantuje, że aplikacja posiada niezbędną licencję do poprawnego działania.

Curtis Chau
Autor tekstów technicznych

Curtis Chau posiada tytuł licencjata z informatyki (Uniwersytet Carleton) i specjalizuje się w front-endowym rozwoju, z ekspertką w Node.js, TypeScript, JavaScript i React. Pasjonuje się tworzeniem intuicyjnych i estetycznie przyjemnych interfejsów użytkownika, Curtis cieszy się pracą z nowoczesnymi frameworkami i tworzeniem dobrze zorganizowanych, atrakcyjnych wizualnie podrę...

Czytaj więcej
Gotowy, aby rozpocząć?
Nuget Pliki do pobrania 41,154 | Wersja: 2026.5 just released
Still Scrolling Icon

Wciąż przewijasz?

Czy chcesz szybko dowodu? PM > Install-Package IronPrint
uruchom próbkę obserwuj, jak twój dokument trafia do drukarki.