Web.configでライセンスキーを設定する
Curtis Chau
更新日: 2026年7月6日
この問題はIronQRバージョン2024.3.2で解決されました。
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronQR must be licensed for development.
Text
古いIronQRバージョン、特にバージョン2024.3.2より前にリリースされたものでは、以下のようにライセンスに関する既知の問題があります。
- ASP.NETプロジェクト
- .NET Frameworkバージョン >= 4.6.2
製品はWeb.configファイルに保存されたキーを使用しません。
回避策
この問題に対処するには、コード内でConfigurationManagerを使用してLicense.LicenseKeyプロパティに適用することをお勧めします。
例:
<configuration>
...
<appSettings>
<add key="IronQR.LicenseKey" value="IronQR-MYLICENSE-KEY-1EF01"/>
</appSettings>
...
</configuration>
XML
上記のXMLファイルを使用して、ConfigurationManagerを使用してライセンスキーの値を取得し、それをIronQr.License.LicenseKeyプロパティに渡すことができます。
using System.Configuration;
// Retrieve the license key from the Web.config file's appSettings section
string licenseKey = ConfigurationManager.AppSettings["IronQR.LicenseKey"];
// Apply the retrieved license key to the IronQR LicenseKey property
IronQr.License.LicenseKey = licenseKey;Imports System.Configuration
' Retrieve the license key from the Web.config file's appSettings section
Dim licenseKey As String = ConfigurationManager.AppSettings("IronQR.LicenseKey")
' Apply the retrieved license key to the IronQR LicenseKey property
IronQr.License.LicenseKey = licenseKeyImports System.Configuration
' Retrieve the license key from the Web.config file's appSettings section
Dim licenseKey As String = ConfigurationManager.AppSettings("IronQR.LicenseKey")
' Apply the retrieved license key to the IronQR LicenseKey property
IronQr.License.LicenseKey = licenseKeyテクニカルライター
Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。