Can I Run IronBarcode with .NET on Azure?
Yes! IronBarcode can be used on read and write QR/barcodes in .NET applications hosted on Azure services. IronBarcode has been thoroughly tested on multiple Azure platforms including MVC websites, Azure Functions, and many more.
Pre-requisites
1. Install IronBarcode to Get Started
First install the NuGet package on the NuGet website.
Install-Package BarCode
As an alternative, the IronBarcode.dll could also be downloaded and added to your project.
How to Tutorial
2. Performance and Azure Tiers
We recommend at least using the Azure B1 service plan, as it's suitable for most of our users' use cases. Systems that require higher throughput will need a higher service plan.
3. Framework Choice
.NET Standard, Core, and Framework projects are all compatible with IronBarcode.
4. Docker on Azure
One way to gain the ability to control performance and stability with IronBarcode on Azure is to use Docker. To learn how to use IronBarcode with Azure and Docker, have a look at this tutorial.
5. Official Azure Function Support
IronBarcode currently supports Azure Functions V3 and V4.
Working Azure Function Code Example
Tested on Azure Functions v3.3.1.0+. Here is a code sample:
[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.");
IronBarCode.License.LicenseKey = "Key";
var MyBarCode = BarcodeWriter.CreateBarcode("IronBarcode Test", BarcodeEncoding.QRCode);
var result = new HttpResponseMessage(HttpStatusCode.OK);
result.Content = new ByteArrayContent(MyBarCode.ToJpegBinaryData());
result.Content.Headers.ContentDisposition =
new ContentDispositionHeaderValue("attachment") { FileName = $"{DateTime.Now.ToString("yyyyMMddmm")}.jpg" };
result.Content.Headers.ContentType =
new MediaTypeHeaderValue("image/jpeg");
return result;
}
[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.");
IronBarCode.License.LicenseKey = "Key";
var MyBarCode = BarcodeWriter.CreateBarcode("IronBarcode Test", BarcodeEncoding.QRCode);
var result = new HttpResponseMessage(HttpStatusCode.OK);
result.Content = new ByteArrayContent(MyBarCode.ToJpegBinaryData());
result.Content.Headers.ContentDisposition =
new ContentDispositionHeaderValue("attachment") { FileName = $"{DateTime.Now.ToString("yyyyMMddmm")}.jpg" };
result.Content.Headers.ContentType =
new MediaTypeHeaderValue("image/jpeg");
return result;
}
<FunctionName("barcode")>
Public Shared 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.")
IronBarCode.License.LicenseKey = "Key"
Dim MyBarCode = BarcodeWriter.CreateBarcode("IronBarcode Test", BarcodeEncoding.QRCode)
Dim result = New HttpResponseMessage(HttpStatusCode.OK)
result.Content = New ByteArrayContent(MyBarCode.ToJpegBinaryData())
result.Content.Headers.ContentDisposition = New ContentDispositionHeaderValue("attachment") With {.FileName = $"{DateTime.Now.ToString("yyyyMMddmm")}.jpg"}
result.Content.Headers.ContentType = New MediaTypeHeaderValue("image/jpeg")
Return result
End Function