web.config での IronOCR ライセンス設定

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

この問題は、IronZIP バージョン2024.3.3解決されました。

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

古い IronZIP バージョン、特に 2024.3.3 より前にリリースされたものには、以下のライセンス問題があります:

  • ASP.NETプロジェクト
  • .NET Frameworkバージョン >= 4.6.2

Web.configファイルに保存されたキーが製品によって使用されません

回避策

この問題に対処するためには、Web.config ファイルからConfigurationManagerを使用してライセンスキーを取得し、それをLicense.LicenseKey プロパティに適用することをお勧めします。

Example:

<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

上記の XML ファイルを使用することで、ConfigurationManager を利用してライセンスキーの値を取得し、IronZip.License.LicenseKey プロパティに渡すことができます。

using System;
using System.Configuration;

class Program
{
    static void Main()
    {
        // Retrieve the license key from the web.config 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.Configuration;

class Program
{
    static void Main()
    {
        // Retrieve the license key from the web.config 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

Friend Class Program
	Shared 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 Class
$vbLabelText   $csharpLabel
  • using System.Configuration; ディレクティブは Web.config などの設定ファイルにアクセスするために使用します。
  • ConfigurationManager.AppSettings["IronZip.LicenseKey"]Web.configappSettings セクションに保存されているライセンスキーを取得します。
  • IronZip.License.LicenseKey = licenseKey; は取得したキーを IronZip ライブラリに割り当て、ライセンス例外を防ぎます。
  • Console.WriteLine() ステートメントは、ライセンスキー適用プロセスが正常に完了したことを開発者にフィードバックします。
カーティス・チャウ
テクニカルライター

Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。

開発以外にも、CurtisはIoT(Internet of Things)への強い関心を持ち、ハードウェアとソフトウェアの統合方法を模索しています。余暇には、ゲームをしたりDiscordボットを作成したりして、技術に対する愛情と創造性を組み合わせています。

準備はできましたか?
Nuget ダウンロード 16,647 | Version: 2025.11 リリース