使用 IronBarcode 授權金鑰
如何取得授權金鑰
添加 IronBarcode 授權金鑰後,您即可無限制且無浮水印地將專案部署至生產環境。
您可在此購買授權金鑰,或註冊免費 30天試用金鑰。
步驟 1:下載 IronBarcode 最新版本
透過 NuGet 安裝
開始之前,我們需要安裝最新版本的 Barcode NuGet 套件。
Install-Package BarCode
透過 DLL 安裝
此外,您亦可下載 IronBarcode.dll 並將其加入您的專案中。
步驟 2:套用您的授權金鑰
使用程式碼設定您的授權
請將此程式碼加入應用程式的啟動階段,位於使用 IronBarcode 之前。
// Apply your IronBarcode license key
IronBarCode.License.LicenseKey = "IRONBARCODE-MYLICENSE-KEY-1EF01";
// Apply your IronBarcode license key
IronBarCode.License.LicenseKey = "IRONBARCODE-MYLICENSE-KEY-1EF01";
' Apply your IronBarcode license key
IronBarCode.License.LicenseKey = "IRONBARCODE-MYLICENSE-KEY-1EF01"
請透過 Web.Config 或 App.Config 設定您的授權
若要透過 Web.Config 或 App.Config 在應用程式中全域套用某個金鑰,請在設定檔的 appSettings 區段中加入以下金鑰:
<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>
IronBarcode 版本 2023.4.1 至 2024.3.2 與以下框架之間存在已知的授權問題:
- ASP.NET 專案
- .NET Framework 版本 >= 4.6.2
產品並未讀取並使用 Web.config 檔案中儲存的金鑰。 請參閱《在 Web.config 中設定授權金鑰》疑難排解文章以了解更多資訊。
使用 .NET Core 的 appsettings.json 檔案設定您的授權金鑰
要在 .NET Core 專案中將金鑰套用至整個應用程式:
- 請在專案的根目錄中新增一個名為
appsettings.json的 JSON 檔案。 - 請在您的 JSON 設定檔中加入
IronBarCode.LicenseKey鍵。其值應為您的授權金鑰。 - 請確保檔案屬性包含"複製至輸出目錄:始終複製"。
檔案:appsettings.json
{
"IronBarCode.LicenseKey": "IRONBARCODE-MYLICENSE-KEY-1EF01"
}
步驟 3:測試您的金鑰
請測試您的金鑰是否已正確安裝。
// Verify if the provided license key is valid
bool result = IronBarCode.License.IsValidLicense("IRONBARCODE-MYLICENSE-KEY-1EF01");
// Check if IronBarCode is licensed successfully
bool is_licensed = IronBarCode.License.IsLicensed;
// Verify if the provided license key is valid
bool result = IronBarCode.License.IsValidLicense("IRONBARCODE-MYLICENSE-KEY-1EF01");
// Check if IronBarCode is licensed successfully
bool is_licensed = IronBarCode.License.IsLicensed;
' Verify if the provided license key is valid
Dim result As Boolean = IronBarCode.License.IsValidLicense("IRONBARCODE-MYLICENSE-KEY-1EF01")
' Check if IronBarCode is licensed successfully
Dim is_licensed As Boolean = IronBarCode.License.IsLicensed
步驟 4:開始您的專案
請參閱我們的教學指南,了解如何開始使用 IronBarcode。
有任何疑問嗎?
如有任何疑問,請聯繫 support@ironsoftware.com
常見問題
我如何為我的 C# 專案獲得授權金鑰?
您可以從授權頁面購買授權金鑰或註冊免費的 30 天試用金鑰。
在 C# 中透過 NuGet 安裝 IronBarcode 的步驟是什麼?
要透過 NuGet 安裝 IronBarcode,請使用命令:Install-Package BarCode。更多資訊可以在 NuGet 套件頁面找到。
有其他方法可以安裝 IronBarcode 而不使用 NuGet 嗎?
是的,您可以直接下載 IronBarcode.dll 並從我們的套件頁面將其添加到您的專案中。
如何在 C# 應用程式中使用程式碼套用授權金鑰?
在應用程式啟動時添加以下程式碼:IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";。
我如何在 .NET 中使用配置文件設置授權金鑰?
在 Web.config 或 App.config 文件的 appSettings 區段中添加授權金鑰,使用金鑰 IronBarCode.LicenseKey。
在 .NET Core 的 appsettings.json 文件中套用授權金鑰的方法是什麼?
在您的 appsettings.json 文件中添加 IronBarCode.LicenseKey 金鑰,並將您的授權金鑰作為值。確保該文件設置為 *Copy to Output Directory: Copy always*。
如果 Web.config 中的授權金鑰未被識別,我該怎麼辦?
特定版本之間有已知問題,導致金鑰未被識別。請參閱我們的故障排除文章以獲取指導。
我如何檢查我的授權金鑰在 C# 中是否有效?
您可以使用 IronBarCode.License.IsValidLicense("YOUR-LICENSE-KEY") 來驗證金鑰,並使用 IronBarCode.License.IsLicensed 檢查是否已獲得授權。
我可以在哪裡找到使用 IronBarcode 的教學?
在我們的文件頁面上,按照我們的教學開始使用 IronBarcode。
我如何聯繫支援尋求有關 IronBarcode 的問題解答?
如有任何問題,請透過電子郵件聯繫 support@ironsoftware.com。
IronBarcode 是否與 .NET 10 及更高版本相容?
是的。IronBarcode 正式支持 .NET 10(以及 .NET 9、8、7、6、5、.NET Core 2.x/3.x、.NET Standard 2.x 和 .NET Framework 4.6.2+)。當透過程式碼、Web.config/App.config 或 appsettings.json 套用授權金鑰時,完全相容。([ironsoftware.com](https://ironsoftware.com/csharp/barcode/features/compatibility/?utm_source=openai))

