Free auditStart free
GuideError · HTTP status codes

504 Gateway Timeout on IIS

A 504 on a Windows host is rarely IIS itself. Find which layer sent it, then check the IIS and .NET timeouts that actually exist: FastCGI, ASP.NET Core and ASP.NET.

3 min
read
7
sources
Oct 31, 2026
updated
Scaplet Editorial Team
author
The short answer

IIS's own status code reference lists server errors 500, 501, 502 and 503, with no 504 substatus, so a 504 usually comes from a gateway in front of IIS or from IIS acting as a proxy. First work out who sent it. Then compare the IIS-side timeouts: FastCGI requestTimeout (90), ASP.NET Core requestTimeout (2 minutes) and ASP.NET executionTimeout (110).

  1. Who sent the 504
  2. IIS substatuses that look like timeouts
  3. The timeouts that exist on an IIS box
  4. Prove where the time goes
  5. SEO and crawler notes
30-second check

Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?
Summarize this page withChatGPTClaudePerplexityGoogleAI Mode
01Checklist

Who sent the 504

RFC 9110 defines 504 as a gateway or proxy that "did not receive a timely response from an upstream server". IIS is usually the upstream. Microsoft's IIS status code reference lists 500, 501, 502 and 503 as the server error codes IIS uses, with substatuses for 500, 502 and 503 only. So when a browser shows a 504 for an IIS site, one of these is the likely sender:
First1
A CDN, load balancer or reverse proxy in front of IIS that gave up waiting.
Next1
IIS itself acting as a reverse proxy to another server (for example with URL Rewrite and Application Request Routing).
Then1
A different service the page calls and passes on.
Look at who answered
curl -sI https://example.com/slow
# Check the Server, Via and any CDN-specific headers.
# Then call the IIS box directly by IP or internal name:
curl -sI -H "Host: example.com" http://10.0.0.12/slow

If the direct call returns 200 slowly, the front layer's timeout is the problem. If it returns a 5xx from IIS, use the substatus below.

02IIS 5xx substatuses (Microsoft's status code reference)

IIS substatuses that look like timeouts

Code

502.1

Meaning
CGI application timeout
Why it matters here
A CGI process ran past its limit
Code

502.2

Meaning
Bad gateway: premature exit
Why it matters here
The process ended before answering
Code

503.0

Meaning
Application pool unavailable
Why it matters here
Pool is stopped or disabled
Code

503.3

Meaning
ASP.NET queue full
Why it matters here
Requests queued up behind slow ones
Code

503.4

Meaning
FastCGI queue full
Why it matters here
Slow PHP or CGI requests fill the queue

Slow requests and queue-full errors often travel together: when every worker is busy with a slow request, new ones wait, and a gateway in front of IIS times out first. Read the substatus in the IIS log to see which one you have.

03Fix it on your stack

The timeouts that exist on an IIS box

FastCGI application timeouts (applicationHost.config), from the Microsoft docs
<fastCgi>
  <application fullPath="C:\PHP\php-cgi.exe" arguments="" maxInstances="4"
               idleTimeout="300" activityTimeout="30" requestTimeout="90"
               instanceMaxRequests="10000" protocol="NamedPipe" flushNamedPipe="false" />
</fastCgi>
ASP.NET Core out-of-process: longer request timeout in web.config
<system.webServer>
  <aspNetCore processPath="dotnet" arguments=".\MyApp.dll"
              requestTimeout="00:05:00" />
</system.webServer>
ASP.NET Framework: execution timeout in seconds
<system.web>
  <httpRuntime executionTimeout="300" />
</system.web>
Documented IIS and .NET timeouts
LayerSettingDefaultApplies to
FastCGI (PHP, others)requestTimeout90 secondsMaximum time a FastCGI process request can take
FastCGIactivityTimeout30 on IIS 7.0, 70 on IIS 7.5Maximum time, in seconds, a FastCGI process can take to process
FastCGIqueueLength1000Requests that can be queued for the process pool
ASP.NET Core ModulerequestTimeout00:02:00Wait for a response from the process; does not apply to in-process hosting
ASP.NET (System.Web)httpRuntime executionTimeout110 secondsApplies only if compilation debug is false
04How it works

Prove where the time goes

  1. 01

    Enable Failed Request Tracing

    Microsoft describes it as buffering trace events for a request and flushing them to disk only when the request fails, with a failure definition you provide. Define a rule for the slow URL and say what counts as a failure for it; the article walks through the URL, failure definition and areas to trace.

  2. 02

    Reproduce the slow request

    Use curl -w "%{time_total}" against IIS directly, then through the front layer, and compare the times.

  3. 03

    Read the trace

    Find the module or handler where the time elapses, then tune that layer rather than the whole stack.

05Explained

SEO and crawler notes

To Google a 504 is a server error: 5xx and 429 responses "prompt Google's crawlers to temporarily slow down with crawling", and for Search "already indexed URLs are preserved in the index, but eventually dropped". A slow page that times out under crawl load is worth fixing at the source. See 504 Gateway Timeout and 403 on IIS for other IIS status behavior.

Questions

Asked a lot.

3 questions people ask next, answered from the sources on this page.

01Does IIS return 504 Gateway Timeout?

Microsoft's IIS status code reference lists 500, 501, 502 and 503 as server error codes and gives no 504 substatus. A 504 on an IIS site normally comes from a proxy, load balancer or CDN in front, or from IIS acting as a gateway.

02What is the default FastCGI timeout in IIS?

requestTimeout defaults to 90 seconds. activityTimeout defaults to 30 on IIS 7.0 and 70 on IIS 7.5, per Microsoft's documentation.

03How do I extend the ASP.NET Core timeout on IIS?

For out-of-process hosting, set requestTimeout on the aspNetCore element in web.config; the default is 00:02:00. It does not apply to in-process hosting.

Sources · 7

Every fact, linked and dated.

Official docs first. The date is when we last opened each page.
  • rfc-editor.org
  • microsoft.com
  • google.com
  1. 01RFC 9110: HTTP Semanticsrfc-editor.org · checked 2026-11-01
  2. 02HTTP status codes in IIS 7.0 and later versionslearn.microsoft.com · checked 2026-11-01
  3. 03FastCGI Application <application>learn.microsoft.com · checked 2026-11-01
  4. 04ASP.NET Core Module configuration (web.config)learn.microsoft.com · checked 2026-11-01
  5. 05httpRuntime element (ASP.NET Settings Schema)learn.microsoft.com · checked 2026-11-01
  6. 06Troubleshoot failed requests using tracing in IIS 7learn.microsoft.com · checked 2026-11-01
  7. 07How HTTP status codes affect Google's crawlersdevelopers.google.com · checked 2026-11-01
Free · 2 minutes

Tools point. Agencies advise. This one ships.

Run the free audit, then approve the fixes. Every change can be undone.

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • 0→7 ChatGPT citations in six weeks Paylane