web.config での IronBarcode ライセンス設定
この問題は、 IronBarcodeのバージョン2024.3.2で解決されました。
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>
<configuration>
...
<appSettings>
<add key="IronBarCode.LicenseKey" value="IRONBARCODE-MYLICENSE-KEY-1EF01"/>
</appSettings>
...
</configuration>
上記のXMLファイルを使用して、ConfigurationManagerを使ってライセンスキーの値を取得し、それをIronBarCode.License.LicenseKeyプロパティに渡すことができます。
using System.Configuration;
// Retrieve the license key from appSettings in the Web.config file
string licenseKey = ConfigurationManager.AppSettings["IronBarCode.LicenseKey"];
// Apply the retrieved license key to the IronBarCode LicenseKey property
IronBarCode.License.LicenseKey = licenseKey;
using System.Configuration;
// Retrieve the license key from appSettings in the Web.config file
string licenseKey = ConfigurationManager.AppSettings["IronBarCode.LicenseKey"];
// Apply the retrieved license key to the IronBarCode LicenseKey property
IronBarCode.License.LicenseKey = licenseKey;
Imports System.Configuration
' Retrieve the license key from appSettings in the Web.config file
Private licenseKey As String = ConfigurationManager.AppSettings("IronBarCode.LicenseKey")
' Apply the retrieved license key to the IronBarCode LicenseKey property
IronBarCode.License.LicenseKey = licenseKey

