更新済み 2024年12月17日
共有:

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

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

This problem has been resolved in the 2024.3.2IronBarcodeのバージョン。

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

古いIronBarcodeバージョン、特にバージョン間のものの場合、2023.4.1以下のコンテンツを日本語に翻訳してください:2024.3.2、以下の箇所に既知のライセンス問題があります:

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

    Web.configファイルに保存されたキーは、製品によって取得されて使用されることはありません

ワークアラウンド

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

例:

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

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

using System.Configuration;

string licenseKey = ConfigurationManager.AppSettings ["IronBarCode.LicenseKey"];

IronBarCode.License.LicenseKey = licenseKey;
using System.Configuration;

string licenseKey = ConfigurationManager.AppSettings ["IronBarCode.LicenseKey"];

IronBarCode.License.LicenseKey = licenseKey;
Imports System.Configuration

Private licenseKey As String = ConfigurationManager.AppSettings ("IronBarCode.LicenseKey")

IronBarCode.License.LicenseKey = licenseKey
$vbLabelText   $csharpLabel