Can I Run IronBarcode with .NET on Azure?
Yes! IronBarcode can be used to 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.
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:
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)> req As HttpRequest,
log As ILogger) As HttpResponseMessage
log.LogInformation("VB.NET 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 ModuleIn this code:
- We define an Azure Function with the name "barcode."
- The function is triggered by an HTTP request and logs a message when processed.
- We specify the license key for IronBarcode (replace
"Key"with your actual license key). - A QR code barcode is generated using
BarcodeWriter.CreateBarcode. - The barcode image is converted to JPEG format and included in the HTTP response.
- The response content is set as a downloadable attachment with the current date and time as the file name.
- The response content type is set to "image/jpeg" to indicate the image format.
Frequently Asked Questions
Can IronBarcode be used with .NET applications on Azure?
Yes, IronBarcode can be used to read and write QR/barcodes in .NET applications hosted on Azure services such as MVC websites and Azure Functions.
What is the recommended Azure service plan for IronBarcode?
It is recommended to use at least the Azure B1 service plan for most use cases, with higher service plans needed for systems requiring more throughput.
Which .NET frameworks are compatible with IronBarcode on Azure?
IronBarcode is compatible with .NET Standard, Core, and Framework projects when running on Azure.
How can Docker be used with IronBarcode on Azure?
Using Docker on Azure can help control performance and stability when deploying IronBarcode, and a tutorial is available for guidance.
Are Azure Functions officially supported by IronBarcode?
Yes, IronBarcode supports Azure Functions V3 and V4, allowing integration of barcode functionalities in Azure serverless computing.
How is a barcode generated and used in an Azure Function with IronBarcode?
In an Azure Function, a barcode can be generated using `BarcodeWriter.CreateBarcode` and returned as an image file in the HTTP response.
What content type is set for barcode images in Azure Functions using IronBarcode?
The content type for barcode images is set to 'image/jpeg' when returned in the HTTP response from an Azure Function using IronBarcode.
Is it necessary to set a license key for using IronBarcode in Azure Functions?
Yes, setting a license key for IronBarcode is necessary in Azure Functions to activate the library and remove any limitations.
What file format is used for barcodes generated by IronBarcode in Azure Functions?
Barcodes generated by IronBarcode in Azure Functions are converted to JPEG format for the HTTP response.
How are content headers set for barcode images in Azure Functions using IronBarcode?
Content headers are set to define the barcode image as a downloadable attachment with the current date and time as part of the file name.

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.