Azure Appservice 504 Gateway Error

Siva Prasad 0 Reputation points
2024-02-03T17:59:15.34+00:00

Hi,

I've set up an ASP.NET web application connected to an Azure SQL database using an App Service Premium plan, while the database is in the Basic Tier. When executing a prolonged calculation that takes approximately 5 minutes to complete, I encounter a 504 error. Despite attempting different App Service plans, the issue persists. My deployment involves placing the web app in Azure App Service and the database in Azure SQL DB, with no additional services configured. The application is not API-based; instead, it's a two-tier monolithic app. I seek guidance on resolving this issue. Thank you.

Azure SQL Database
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,759 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Silvia Wibowo 3,906 Reputation points Microsoft Employee
    2024-02-05T05:03:18.7966667+00:00

    Hi @Siva Prasad , I understand that you are using App Service for 2-tier app but it times out when your SQL DB takes 5 minutes to respond.

    App Service uses Load Balancer (internally, you can't access the Load Balancer configuration) and it times out after 230 seconds on Windows app, 240 seconds on Linux app. I'd suggest you to look at possibility of using loosely coupled architecture rather than real-time, such as using a Service Bus.

    More info: loosely coupled communications.

    Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.

    0 comments No comments

  2. VenkateshDodda-MSFT 20,696 Reputation points Microsoft Employee
    2024-02-06T13:22:58.1333333+00:00

    @Siva Prasad Thanks for your response, as @Siva Prasad mentioned app service has default time out of 240 seconds within that specified time if it doesn't receive any response from client application, it will be timed out as documented here.

    Also note that this time out cannot be changed or increased, and it is recommended to have web jobs if you have any long running tasks.

    You can also troubleshoot this issue by running the various detector under Diagnose and solve problems of your webapp.

    1. WebApp Down Detector.
    2. Http 5xx errors.

    To understand and to identify the cause of this issue.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.