IRONSOFTWAREHOME

502 Bad Gateway in Azure

Curtis Chau
Curtis Chau
Updated: April 24, 2026

The 502 Bad Gateway error is an HTTP status code that generally indicates a gateway server received a faulty response from another server. In relation to IronPDF, this error can occur when deployed to Azure.

In this article, you will find several suggestions for how to resolve this error in Azure.

1. Uncheck "Run from package file"

When deploying your application to Azure in Visual Studio, you will be presented with a Run from package file option. Ensure this is unchecked before deploying your application to Azure. You could also set WEBSITE_RUN_FROM_PACKAGE = 0 in your application settings.

For more information on running your application from a package file, take a look at Microsoft's official documentation.

2. Change the region

At times, the systems of certain Azure regions will update, causing conflicts with IronPDF. If possible, redeploy your application to another region.

3. Set to run in Single Process mode

In your code, add the following line to your application and redeploy:

// Set IronPDF to run in single process mode
Installation.SingleProcess = true;

By default, IronPDF runs as a multi-process software module, spawning a new process for whatever task it is given (whether it be rendering HTML, sending a URL request, etc.). This makes IronPDF fault-tolerant but less likely to run properly in constrained environments. When setting the option above, IronPDF will run as a single process, which will reduce its fault tolerance but will improve the likelihood the library will run properly in constrained environments.

Because of this "trade-off", we recommend trying the above two suggestions first before trying this one.

4. Containerize your application

To ensure no changes in the Azure system tamper with IronPDF, containerize your application with Docker.

You can learn more about how to containerize IronPDF with Docker by following this link.

Still not working?

If you have tried all of the suggestions above and your application is still throwing the 502 Bad Gateway error, contact us at support@ironsoftware.com.

To learn how to make a support request, follow this link, and to learn how to retrieve log files from Azure, follow this link.

Curtis Chau
Technical Writer

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.

...
Read More

Ready to Get Started?

Nuget Downloads 20,389,208Version:2026.8just released

Get your free 30-day Trial Key instantly.
No credit card or account creation required

Try IronPDF for Free

Get Set Up in 5 Minutes

C# PDF DLL

Download DLL

Download Now

or download Windows Installer here.

  1. Download and unzip IronPDF to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronPdf.dll"
C# NuGet Library for PDF

Install with NuGet

                  Install-Package IronPdf
                
nuget.org/packages/IronPdf/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronPdf"
  3. Select the package and install
Key in blue circle

Get your free 30-day Trial Key instantly.

bullet_checkedNo credit card or account creation required
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge related to IronPDF Product Demo

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required