IronBarcode 開始使用 生成 Azure 支援 我可以在 Azure 上使用 .NET 執行 IronBarcode 嗎? Curtis Chau 更新:2025年7月24日 下載 IronBarcode NuGet 下載 DLL 下載 開始免費試用 法學碩士副本 法學碩士副本 將頁面複製為 Markdown 格式,用於 LLMs 在 ChatGPT 中打開 請向 ChatGPT 諮詢此頁面 在雙子座打開 請向 Gemini 詢問此頁面 在 Grok 中打開 向 Grok 詢問此頁面 打開困惑 向 Perplexity 詢問有關此頁面的信息 分享 在 Facebook 上分享 分享到 X(Twitter) 在 LinkedIn 上分享 複製連結 電子郵件文章 This article was translated from English: Does it need improvement? Translated View the article in English 是的! IronBarcode 可用於在 Azure 服務上託管的 .NET 應用程式中讀取和寫入 QR/條碼。 IronBarcode 在多個 Azure 平台上進行了全面測試,包括 MVC 網站、Azure Functions 等。 先決條件 1. 安裝 IronBarcode 開始使用 首先,在NuGet 網站上安裝 NuGet 套件。 Install-Package BarCode As an alternative, the IronBarcode.dll could also be downloaded and added to your project. 操作指南 2. 效能和 Azure 層 我們建議至少使用 Azure B1服務計劃,因為它適合我們大多數使用者的使用情境。 需要更高吞吐量的系統需要更高等級的服務套餐。 3. 框架選擇 .NET Standard、Core 和 Framework 項目都與 IronBarcode 兼容。 4. Azure 上的 Docker 想要在 Azure 上使用 IronBarcode 來控制效能和穩定性,一種方法是使用 Docker。 若要了解如何將 IronBarcode 與 Azure 和 Docker 結合使用,請查看本教學。 5. 官方 Azure 函數支持 IronBarcode 目前支援 Azure Functions V3 和 V4。 Azure 函數程式碼範例 已在 Azure Functions v3.3.1.0+ 上測試。 以下是一個程式碼範例: using System; using System.Net; using System.Net.Http; using IronBarCode; using Microsoft.AspNetCore.Http; using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.Http; using Microsoft.Extensions.Logging; using System.Net.Http.Headers; public static class BarcodeFunction { // Azure Function triggered by HTTP request. [FunctionName("barcode")] public static HttpResponseMessage Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); // Set the license key for IronBarcode if needed. IronBarCode.License.LicenseKey = "Key"; // Create a QR barcode from a string. var myBarCode = BarcodeWriter.CreateBarcode("IronBarcode Test", BarcodeEncoding.QRCode); // Prepare the HTTP response to return the barcode image. var response = new HttpResponseMessage(HttpStatusCode.OK) { Content = new ByteArrayContent(myBarCode.ToJpegBinaryData()) }; // Set content headers for attachment and content type. response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = $"{DateTime.Now:yyyyMMddmm}.jpg" }; response.Content.Headers.ContentType = new MediaTypeHeaderValue("image/jpeg"); return response; } } using System; using System.Net; using System.Net.Http; using IronBarCode; using Microsoft.AspNetCore.Http; using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.Http; using Microsoft.Extensions.Logging; using System.Net.Http.Headers; public static class BarcodeFunction { // Azure Function triggered by HTTP request. [FunctionName("barcode")] public static HttpResponseMessage Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); // Set the license key for IronBarcode if needed. IronBarCode.License.LicenseKey = "Key"; // Create a QR barcode from a string. var myBarCode = BarcodeWriter.CreateBarcode("IronBarcode Test", BarcodeEncoding.QRCode); // Prepare the HTTP response to return the barcode image. var response = new HttpResponseMessage(HttpStatusCode.OK) { Content = new ByteArrayContent(myBarCode.ToJpegBinaryData()) }; // Set content headers for attachment and content type. response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = $"{DateTime.Now:yyyyMMddmm}.jpg" }; response.Content.Headers.ContentType = new MediaTypeHeaderValue("image/jpeg"); return response; } } Imports System Imports System.Net Imports System.Net.Http Imports IronBarCode Imports Microsoft.AspNetCore.Http Imports Microsoft.Azure.WebJobs Imports Microsoft.Azure.WebJobs.Extensions.Http Imports Microsoft.Extensions.Logging Imports System.Net.Http.Headers Public Module BarcodeFunction ' Azure Function triggered by HTTP request. <FunctionName("barcode")> Public Function Run(<HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route := Nothing)> ByVal req As HttpRequest, ByVal log As ILogger) As HttpResponseMessage log.LogInformation("C# HTTP trigger function processed a request.") ' Set the license key for IronBarcode if needed. IronBarCode.License.LicenseKey = "Key" ' Create a QR barcode from a string. Dim myBarCode = BarcodeWriter.CreateBarcode("IronBarcode Test", BarcodeEncoding.QRCode) ' Prepare the HTTP response to return the barcode image. Dim response = New HttpResponseMessage(HttpStatusCode.OK) With {.Content = New ByteArrayContent(myBarCode.ToJpegBinaryData())} ' Set content headers for attachment and content type. response.Content.Headers.ContentDisposition = New ContentDispositionHeaderValue("attachment") With {.FileName = $"{DateTime.Now:yyyyMMddmm}.jpg"} response.Content.Headers.ContentType = New MediaTypeHeaderValue("image/jpeg") Return response End Function End Module $vbLabelText $csharpLabel 在此程式碼中 我們定義了一個名為"barcode"的 Azure 函數。 此函數由 HTTP 請求觸發,並在處理後記錄一則訊息。 我們指定 IronBarcode 的許可證金鑰(將"Key"替換為您的實際許可證金鑰)。 使用BarcodeWriter.CreateBarcode來產生 QR 碼條碼。 條碼圖像被轉換為 JPEG 格式並包含在 HTTP 回應中。 回覆內容將以可下載附件的形式提供,檔案名稱包含目前日期和時間。 回應內容類型設定為"image/jpeg",以指示圖片格式。 常見問題解答 如何將條碼功能集成到我的 Azure 應用程序中? 您可以通過使用 IronBarcode 將條碼功能集成到您的 Azure 應用程序中。 首先通過命令行安裝 IronBarcode NuGet 套件或下載 IronBarcode.dll 並將其添加到您的項目中。 哪些 Azure 服務計劃適合條碼處理? 對於大多數使用情況,在使用 IronBarcode 時推薦使用 Azure B1 服務計劃。 如果您的應用程序需要更高的吞吐量,請考慮升級到更高的服務計劃。 IronBarcode 是否與 Azure 上的所有 .NET 框架兼容? 是的,IronBarcode 與 .NET Standard、Core 和 Framework 項目兼容,允許在 Azure 上部署應用程序時具有靈活性。 我可以使用 Docker 提高 Azure 上條碼處理的性能嗎? 是的,您可以使用 Docker 提高 Azure 上條碼處理的性能和穩定性。 有關將 IronBarcode 與 Docker 整合的詳細教程。 IronBarcode 庫是否支持 Azure Functions? IronBarcode 支持 Azure Functions V3 和 V4。 它允許在無服務器環境中無縫整合條碼處理。 Azure Functions 如何使用 IronBarcode 處理條碼? 可以設置一個 Azure Function,在 HTTP 請求觸發時使用 IronBarcode 生成 QR 碼。 它會記錄一條消息,設置許可證密鑰,使用 BarcodeWriter.CreateBarcode 創建 QR 碼,並在 HTTP 響應中將圖像作為 JPEG 文件返回。 在 Azure 函數中創建 QR 碼需要什麼代碼? 在 Azure Function 中,使用 IronBarcode 創建 QR 碼,調用 BarcodeWriter.CreateBarcode 於函數內。 然後可以將生成的 QR 碼作為 JPEG 圖像返回到 HTTP 響應中。 Curtis Chau 立即與工程團隊聊天 技術撰稿人 Curtis Chau 擁有電腦科學學士學位(卡爾頓大學),專長於前端開發,精通 Node.js、TypeScript、JavaScript 和 React。Curtis 對製作直覺且美觀的使用者介面充滿熱情,他喜歡使用現代化的架構,並製作結構良好且視覺上吸引人的手冊。除了開發之外,Curtis 對物聯網 (IoT) 也有濃厚的興趣,他喜歡探索整合硬體與軟體的創新方式。在空閒時間,他喜歡玩遊戲和建立 Discord bots,將他對技術的熱愛與創意結合。 準備好開始了嗎? Nuget 下載 2,070,733 | 版本: 2026.2 剛剛發布 免費 NuGet 下載 總下載量:2,070,733 查看許可證