使用 IronPrint 授權金鑰
如何取得授權金鑰
新增 IronPrint 授權金鑰後,您即可無限制且無浮水印地將專案部署至生產環境。
您可在此購買授權金鑰,或註冊免費 30天試用授權。
步驟 1:下載 IronPrint 最新版本
步驟 2:套用您的授權金鑰
使用程式碼設定您的授權
請將此程式碼加入應用程式的啟動部分,位於使用 IronPrint 之前。 請務必將 YOUR_LICENSE_KEY 替換為您的實際 IronPrint 授權金鑰。
using IronPrint;
class Program
{
static void Main()
{
// Apply the IronPrint license key at the start of your application
IronPrint.LicenseKey = "YOUR_LICENSE_KEY";
// Verify that the license key is applied
if (IronPrint.License.IsLicensed)
{
Console.WriteLine("License is applied successfully.");
}
else
{
Console.WriteLine("Failed to apply the license.");
}
// Start using IronPrint features
// Your code logic goes here
}
}
using IronPrint;
class Program
{
static void Main()
{
// Apply the IronPrint license key at the start of your application
IronPrint.LicenseKey = "YOUR_LICENSE_KEY";
// Verify that the license key is applied
if (IronPrint.License.IsLicensed)
{
Console.WriteLine("License is applied successfully.");
}
else
{
Console.WriteLine("Failed to apply the license.");
}
// Start using IronPrint features
// Your code logic goes here
}
}
Imports IronPrint
Friend Class Program
Shared Sub Main()
' Apply the IronPrint license key at the start of your application
IronPrint.LicenseKey = "YOUR_LICENSE_KEY"
' Verify that the license key is applied
If IronPrint.License.IsLicensed Then
Console.WriteLine("License is applied successfully.")
Else
Console.WriteLine("Failed to apply the license.")
End If
' Start using IronPrint features
' Your code logic goes here
End Sub
End Class
請透過 Web.Config 或 App.Config 設定您的授權
若要透過 Web.Config 或 App.Config 在應用程式中全域套用某個金鑰,請在設定檔的 appSettings 區段中加入以下金鑰:
<configuration>
...
<appSettings>
<add key="IronPrint.LicenseKey" value="IRONPRINT.MYLICENSE.KEY.1EF01"/>
</appSettings>
...
</configuration>
<configuration>
...
<appSettings>
<add key="IronPrint.LicenseKey" value="IRONPRINT.MYLICENSE.KEY.1EF01"/>
</appSettings>
...
</configuration>
在專案中使用 2024.3.6 之前版本的 IronPrint 時,存在已知的授權問題:
- ASP.NET 專案
- .NET Framework 版本 >= 4.6.2
儲存在 Web.config 檔案中的金鑰並未被產品讀取及使用。 請參閱"在 Web.config 中設定授權金鑰"的疑難排解文章以了解更多資訊。
請確保 IronPrint.License.IsLicensed 返回 true,以驗證您的應用程式是否已正確授權。
使用 .NET Core 的 appsettings.json 檔案設定您的授權金鑰
要在 .NET Core 應用程式中將金鑰套用至全域範圍:
- 請在專案的根目錄中新增一個名為
appsettings.json的 JSON 檔案。 - 請在您的 JSON 設定檔中新增一個 'IronPrint.LicenseKey' 鍵。其值應為您的授權金鑰。
- 請確保檔案屬性中包含 複製至輸出目錄:始終複製。
檔案:appsettings.json
{
"IronPrint.LicenseKey": "IRONPRINT.MYLICENSE.KEY.1EF01"
}
步驟 3:驗證您的授權金鑰
驗證已安裝的授權金鑰
若要驗證授權金鑰是否已正確套用,您可以檢查 IsLicensed 屬性。 請使用以下程式碼片段:
using IronPrint;
class LicenseCheck
{
static void Main()
{
// Check if the license is applied
bool isLicensed = IronPrint.License.IsLicensed;
Console.WriteLine(isLicensed ? "License applied." : "License not applied.");
}
}
using IronPrint;
class LicenseCheck
{
static void Main()
{
// Check if the license is applied
bool isLicensed = IronPrint.License.IsLicensed;
Console.WriteLine(isLicensed ? "License applied." : "License not applied.");
}
}
Imports IronPrint
Friend Class LicenseCheck
Shared Sub Main()
' Check if the license is applied
Dim isLicensed As Boolean = IronPrint.License.IsLicensed
Console.WriteLine(If(isLicensed, "License applied.", "License not applied."))
End Sub
End Class
驗證授權金鑰
為確保您的授權或試用金鑰有效,您可以使用以下程式碼片段:
using IronPrint;
class ValidateLicense
{
static void Main()
{
// Validate license or trial key
bool isValid = IronPrint.License.IsValid;
Console.WriteLine(isValid ? "License key is valid." : "License key is invalid.");
}
}
using IronPrint;
class ValidateLicense
{
static void Main()
{
// Validate license or trial key
bool isValid = IronPrint.License.IsValid;
Console.WriteLine(isValid ? "License key is valid." : "License key is invalid.");
}
}
Imports IronPrint
Friend Class ValidateLicense
Shared Sub Main()
' Validate license or trial key
Dim isValid As Boolean = IronPrint.License.IsValid
Console.WriteLine(If(isValid, "License key is valid.", "License key is invalid."))
End Sub
End Class
若回傳值為 True,表示該金鑰有效,您可以繼續使用 IronPrint。 然而,若回傳值為 False,則表示該金鑰無效。
步驟 4:開始您的專案
若要開始使用 IronPrint,我們強烈建議您參閱我們的完整教學指南《IronPrint 入門指南》。 本教學提供詳細的說明與範例,協助您掌握使用 IronPrint 的基礎知識。
有任何疑問或需要支援嗎?
若要在實際專案中使用 IronPrint,您需要付費或試用授權金鑰,可透過購買授權取得。 請點擊此連結取得試用授權。
如需查閱完整的程式碼範例、教學指南、授權詳情及詳盡文件,請造訪我們網站上的 IronPrint 專區。
如有任何疑問,歡迎隨時聯繫我們support@ironsoftware.com。/support@ironsoftware.com
常見問題
我如何獲取 C# 列印應用程式的授權金鑰?
您可以從 IronPrint 授權頁面購買授權金鑰,或註冊免費 30 天試用金鑰,以無限制地實時部署您的專案。
在 C# 中套用授權金鑰有哪些步驟?
要在 C# 中套用授權金鑰,請在應用程式啟動時使用程式碼 IronPrint.LicenseKey = "YOUR_LICENSE_KEY";。將 "YOUR_LICENSE_KEY" 替換為您的實際授權金鑰。
如何在 Web.Config 或 App.Config 中設置授權金鑰?
使用以下程式碼將您的授權金鑰新增到配置文件的 appSettings 區段:<add key="IronPrint.LicenseKey" value="YOUR_LICENSE_KEY"/>。
如果我的授權金鑰未在 Web.config 中應用,我應該怎麼做?
確保您正在使用 2024.3.6 之後發布的版本。如果問題持續,請查閱 IronPrint 網站上的‘設定授權金鑰在 Web.config’故障排除文章。
如何在 .NET Core 應用程式中套用授權金鑰?
在 .NET Core 應用程式中,新增一個具有鍵值對的 appsettings.json 文件:{ "IronPrint.LicenseKey": "YOUR_LICENSE_KEY" },並將其屬性設置為‘總是複製到輸出目錄’。
我如何驗證我的 IronPrint 授權金鑰是否正確應用?
使用程式碼片段 bool isLicensed = IronPrint.License.IsLicensed; 檢查您的授權金鑰是否正確應用。返回值 true 表示應用成功。
我如何驗證我的 IronPrint 授權金鑰的有效性?
要驗證您的授權金鑰,請使用 bool isValid = IronPrint.License.IsValid;。如果它返回 true,則表示您的金鑰是有效的。
我在哪裡可以找到開始使用 IronPrint 的資源?
存取 IronPrint 網站,獲取完整的教程、程式碼範例和豐富的文件,以幫助您在項目中開始使用 IronPrint。
如果我需要 IronPrint 的支援,我應該怎麼做?
如需支援,您可以發送電子郵件到
IronPrint 是否相容 .NET 10,並且在該環境中的授權如何運作?
是的 —— IronPrint 支援 .NET 10,以及 .NET 9、8、7、6 和 .NET Core 3.1+,以及 .NET Framework 4.6.2+。授權在 .NET 10 中的運作方式相同:通過程式碼設置您的授權金鑰(IronPrint.LicenseKey = "YOUR_LICENSE_KEY";),或使用配置(appsettings.json)全域應用它。可使用 IsLicensed 屬性驗證應用成功。功能和與 .NET 10 的相容性記錄在功能部分中。([ironsoftware.com](https://ironsoftware.com/csharp/print/features/?utm_source=openai))

