Can I Run IronXL with .NET on Azure?

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

Yes, IronXL can be used on Azure to generate QR & Barcodes in C# & VB .NET Applications, and also read Barcodes & QR Codes from scanned images.

IronXL has been thoroughly tested on multiple Azure platforms including MVC websites, Azure Functions, and many more.


Step 1

1. Install IronXL to Get Started

First install with NuGet: https://www.nuget.org/packages/IronXL.Excel

Install-Package IronXL.Excel

How to Tutorial

2. Performance and Azure Tiers

We recommend that Azure B1 hosting levels are very suitable for our end users' Library needs. If they are creating a high throughput system, this may need to be upgraded.

3. Framework Choice

We have found that IronXL for Core and for Framework both work on Azure. .NET Standard applications seem to have a small performance advantage on speed and stability, but use more memory in process.

Azure free tier hosting is slow

Azure free and shared tiers, and the consumption plan, are not suitable for QR processing. We recommend Azure B1 hosting/Premium plan, which is what we use ourselves.

4. Docker on Azure

One way to gain the ability to control performance on Azure is to use IronXL applications and Functions from within Docker Containers.

We have a comprehensive IronXL Azure Docker tutorial for Linux and Windows instances and it is recommended reading.

5. Official Azure Function Support

IronXL supports Azure Function (Azure Functions V3). It hasn't been tested with V4 till now, but it is in our queue.

Working Azure Function Code Example

Tested on Azure Functions v3.3.1.0+. Here is a sample code:

using System.Net;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using IronXL;
using System.Net.Http.Headers;

// This is an Azure Function that processes an HTTP request and returns an Excel file
[FunctionName("excel")]
public static HttpResponseMessage Run(
    [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
    ILogger log)
{
    // Log the processing of the request
    log.LogInformation("C# HTTP trigger function processed a request.");

    // Set the IronXL license key
    IronXL.License.LicenseKey = "Key";

    // Load an existing workbook
    var workBook = WorkBook.Load("test-wb.xlsx");

    // Create a response with the workbook content as an attachment
    var result = new HttpResponseMessage(HttpStatusCode.OK);
    result.Content = new ByteArrayContent(workBook.ToByteArray());
    result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
    { 
        FileName = $"{DateTime.Now:yyyyMMddmm}.xlsx" 
    };
    result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");

    // Return the response
    return result;
}
using System.Net;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using IronXL;
using System.Net.Http.Headers;

// This is an Azure Function that processes an HTTP request and returns an Excel file
[FunctionName("excel")]
public static HttpResponseMessage Run(
    [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
    ILogger log)
{
    // Log the processing of the request
    log.LogInformation("C# HTTP trigger function processed a request.");

    // Set the IronXL license key
    IronXL.License.LicenseKey = "Key";

    // Load an existing workbook
    var workBook = WorkBook.Load("test-wb.xlsx");

    // Create a response with the workbook content as an attachment
    var result = new HttpResponseMessage(HttpStatusCode.OK);
    result.Content = new ByteArrayContent(workBook.ToByteArray());
    result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
    { 
        FileName = $"{DateTime.Now:yyyyMMddmm}.xlsx" 
    };
    result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");

    // Return the response
    return result;
}
Imports System.Net
Imports Microsoft.Azure.WebJobs
Imports Microsoft.Azure.WebJobs.Extensions.Http
Imports Microsoft.AspNetCore.Http
Imports Microsoft.Extensions.Logging
Imports IronXL
Imports System.Net.Http.Headers

' This is an Azure Function that processes an HTTP request and returns an Excel file
<FunctionName("excel")>
Public Shared Function Run(<HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route := Nothing)> ByVal req As HttpRequest, ByVal log As ILogger) As HttpResponseMessage
	' Log the processing of the request
	log.LogInformation("C# HTTP trigger function processed a request.")

	' Set the IronXL license key
	IronXL.License.LicenseKey = "Key"

	' Load an existing workbook
	Dim workBook = WorkBook.Load("test-wb.xlsx")

	' Create a response with the workbook content as an attachment
	Dim result = New HttpResponseMessage(HttpStatusCode.OK)
	result.Content = New ByteArrayContent(workBook.ToByteArray())
	result.Content.Headers.ContentDisposition = New ContentDispositionHeaderValue("attachment") With {.FileName = $"{DateTime.Now:yyyyMMddmm}.xlsx"}
	result.Content.Headers.ContentType = New MediaTypeHeaderValue("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")

	' Return the response
	Return result
End Function
$vbLabelText   $csharpLabel

常见问题解答

我如何在 Azure 上运行 .NET 应用程序?

您可以使用 IronXL 在 Azure 上运行 .NET 应用程序。它允许在 C# 和 VB .NET 应用程序中生成 QR 和条形码,并从扫描图像中读取。它已在各种 Azure 平台上进行测试,包括 MVC 网站和 Azure 功能。

最佳性能的 Azure 托管级别建议是什么?

对于 IronXL 的最佳性能,我们建议使用 Azure B1 托管级别。如果您正在设计高吞吐量系统,请考虑升级到更高层级。

哪个 .NET 框架在 Azure 上运行效果最好?

IronXL 可在 Azure 上的 .NET Core 和 .NET Framework 上运行。然而,.NET Standard 应用程序在速度和稳定性方面提供了略微的性能优势,但同时内存使用增加。

Azure 的免费层足以进行 QR 处理吗?

对使用 IronXL 进行 QR 处理而言,Azure 的免费和共享层以及消费计划均不建议。我们建议使用 Azure B1 托管或高级计划来获得更好的性能。

可以使用 Docker 管理 Azure 上的 IronXL 应用程序吗?

是的,您可以使用 Docker 来管理 Azure 上的 IronXL 应用程序和功能。该设置允许更好地控制性能。提供了适用于 Linux 和 Windows 实例的详细 Azure Docker 教程。

IronXL 是否支持 Azure Functions?

是的,IronXL 支持 Azure Functions V3。关于 Azure Functions V4 的测试正在进行中,计划在未来扩展支持。

如何安装 IronXL 用于在 Azure 上使用?

您可以使用以下命令通过 NuGet 安装 IronXL:nuget install IronXL.Excel

有使用 IronXL 与 Azure Functions 的示例吗?

有,文章提供了一个示例 Azure Function 代码处理 HTTP 请求并返回 Excel 文件。该示例经过测试,适用于 Azure Functions v3.3.1.0+。

Curtis Chau
技术作家

Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。

除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。

准备开始了吗?
Nuget 下载 1,686,155 | 版本: 2025.11 刚刚发布