.NET ile Azure'da IronBarcode Çalıştırabilir miyim?

This article was translated from English: Does it need improvement?
Translated
View the article in English

Evet! IronBarcode, Azure hizmetlerinde barındırılan .NET uygulamalarında QR/barkod okumak ve yazmak için kullanılabilir. IronBarcode, MVC web siteleri, Azure Functions ve daha pek çok platformda kapsamlı bir şekilde test edilmiştir.


Ön koşullar

1. Başlamak için IronBarcode'u Yükleyin

Öncelikle, NuGet web sitesinde NuGet paketini kurun.

Install-Package BarCode

As an alternative, the IronBarcode.dll could also be downloaded and added to your project.


Nasıl Yapılır Eğitimi

2. Performans ve Azure Katmanları

Çoğu kullanıcı senaryosu için uygun olduğu için, en azından Azure B1 hizmet planını kullanmanızı öneririz. Daha yüksek verim gerektiren sistemler daha yüksek bir hizmet planına ihtiyaç duyacaktır.

3. Çerçeve Seçimi

.NET Standard, Core ve Framework projeleri IronBarcode ile uyumludur.

4. Azure'da Docker

Azure'da IronBarcode ile performans ve kararlılığı kontrol etme yeteneği kazanmanın bir yolu Docker kullanmaktır. IronBarcode'un Azure ve Docker ile nasıl kullanılacağını öğrenmek için bu eğitime göz atın.

5. Resmi Azure İşlev Desteği

IronBarcode şu anda Azure Functions V3 ve V4'ü desteklemektedir.

Azure İşlevi Kod Örneği

Azure Functions v3.3.1.0+ üzerinde test edilmiştir. İşte bir kod örneği:

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

Bu kodda:

  • 'barkod' adıyla bir Azure İşlevi tanımlıyoruz.
  • İşlev bir HTTP isteğiyle tetiklenir ve işlendiğinde bir mesajı kaydeder.
  • IronBarcode için lisans anahtarını belirtiyoruz ("Key" 'yi kendi lisans anahtarınızla değiştirin).
  • Bir QR kodu barkodu BarcodeWriter.CreateBarcode kullanılarak oluşturulur.
  • Barkod görüntüsü JPEG formatına dönüştürülür ve HTTP yanıtına eklenir.
  • Yanıt içeriği, mevcut tarih ve saat ile dosya adı olarak indirilebilir bir ek olarak ayarlanır.
  • Yanıt içerik türü, görüntü formatını belirtecek şekilde "image/jpeg" olarak ayarlanır.

Sıkça Sorulan Sorular

Azure uygulamalarıma barkod işlevselliğini nasıl entegre edebilirim?

IronBarcode kullanarak Azure uygulamalarınıza barkod işlevselliğini entegre edebilirsiniz. Komut satırı aracılığıyla IronBarcode NuGet paketini kurarak veya IronBarcode.dll dosyasını indirip projenize ekleyerek başlayın.

Barkod işlemleri için hangi Azure hizmet planları uygundur?

Çoğu kullanım durumu için, IronBarcode kullanırken Azure B1 hizmet planı önerilir. Eğer uygulamanız daha yüksek veri geçişi gerektiriyorsa, daha yüksek bir hizmet planına yükseltmeyi düşünün.

IronBarcode, Azure'daki tüm .NET çerçeveleri ile uyumlu mu?

Evet, IronBarcode .NET Standard, Core ve Framework projeleri ile uyumludur, Azure'da uygulama dağıtmada esneklik sağlar.

Docker'ı Azure'da barkod işleme performansını artırmak için kullanabilir miyim?

Evet, Azure'da barkod işleme performansını ve kararlılığını artırmak için Docker'ı kullanabilirsiniz. IronBarcode'u Docker ile entegre etmek için detaylı bir öğretici mevcuttur.

IronBarcode kütüphaneleri Azure Fonksiyonlarını destekliyor mu?

IronBarcode, Azure Fonksiyonları V3 ve V4'ü destekler. Sunucusuz ortamlarda barkod işlemesi için kesintisiz entegrasyon sağlar.

Azure Fonksiyonu, IronBarcode kullanarak barkodları nasıl işler?

Azure Fonksiyonu, IronBarcode kullanarak bir HTTP isteği ile tetiklendiğinde bir QR kodu oluşturabilir. Bir mesaj kaydeder, bir lisans anahtarı ayarlar, BarcodeWriter.CreateBarcode kullanarak bir QR kodu oluşturur ve HTTP yanıtında görüntüyü JPEG dosyası olarak döndürür.

Azure Fonksiyonunda bir QR kodu oluşturmak için hangi kod gereklidir?

Azure Fonksiyonu içerisinde, IronBarcode kullanarak BarcodeWriter.CreateBarcode'ı çağırarak bir QR kodu oluşturun. Oluşturulan QR kodu ardından HTTP yanıtında JPEG görüntüsü olarak döndürülebilir.

Curtis Chau
Teknik Yazar

Curtis Chau, Bilgisayar Bilimleri alanında lisans derecesine sahiptir (Carleton Üniversitesi) ve Node.js, TypeScript, JavaScript ve React konularında uzmanlaşmış ön uç geliştirme üzerine uzmanlaşmıştır. Kullanıcı dostu ve estetik açıdan hoş arayüzler tasarlamaya tutkuyla bağlı olan Curtis, modern çerç...

Daha Fazlasını Oku
Başlamaya Hazır mısınız?
Nuget İndirmeler 2,169,908 | Sürüm: 2026.4 just released
Still Scrolling Icon

Hala Kaydiriyor musunuz?

Hızlı bir kanit mi istiyorsunuz? PM > Install-Package BarCode
bir örnek çalıştırın dize barkod haline geldiğini görün.