# 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.

Canonical: https://scaplet.com/errors/http/504/iis

Guide Error · HTTP status codes

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

504 5xx · Server error

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](#who-sent-the-504)
2. [IIS substatuses that look like timeouts](#iis-substatuses-that-look-like-timeouts)
3. [The timeouts that exist on an IIS box](#the-timeouts-that-exist-on-an-iis-box)
4. [Prove where the time goes](#prove-where-the-time-goes)
5. [SEO and crawler notes](#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 with [ChatGPT](https://chatgpt.com/?hints=search&q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F504%2Fiis%20(%22504%20Gateway%20Timeout%20on%20IIS%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Claude](https://claude.ai/new?q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F504%2Fiis%20(%22504%20Gateway%20Timeout%20on%20IIS%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Perplexity](https://www.perplexity.ai/search?q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F504%2Fiis%20(%22504%20Gateway%20Timeout%20on%20IIS%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [![Google](/logos/ai/google-color.svg)AI Mode](https://www.google.com/search?udm=50&q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F504%2Fiis%20(%22504%20Gateway%20Timeout%20on%20IIS%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

_01_Checklist

## 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](/glossary/http-status-codes) 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:

First_1_
A CDN, load balancer or reverse proxy in front of IIS that gave up waiting.

Next_1_
IIS itself acting as a reverse proxy to another server (for example with URL Rewrite and Application Request Routing).

Then_1_
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.

_02_IIS 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.

_03_Fix it on your stack

## The timeouts that exist on an IIS box

FastCGI application timeouts (applicationHost.config), from the Microsoft docs
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
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
ASP.NET Framework: execution timeout in seconds

```
<system.web> <httpRuntime executionTimeout="300" /> </system.web>
```

Documented IIS and .NET timeouts
| Layer | Setting | Default | Applies to |
| FastCGI (PHP, others) | `requestTimeout` | 90 seconds | Maximum time a FastCGI process request can take |
| FastCGI | `activityTimeout` | 30 on IIS 7.0, 70 on IIS 7.5 | Maximum time, in seconds, a FastCGI process can take to process |
| FastCGI | `queueLength` | 1000 | Requests that can be queued for the process pool |
| ASP.NET Core Module | `requestTimeout` | `00:02:00` | Wait for a response from the process; does not apply to in-process hosting |
| ASP.NET (System.Web) | `httpRuntime executionTimeout` | 110 seconds | Applies only if `compilation debug` is false |

**Match the layers**Raising one timeout does nothing if a shorter one sits in front. A 5 minute `requestTimeout` behind a 60 second load balancer still returns a 504 at 60 seconds.

_04_How 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.

_05_Explained

## 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](/errors/http/504) and [403 on IIS](/errors/http/403/iis) for other IIS status behavior.

Questions

## Asked a lot.

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

_01_ Does 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.

_02_ What 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.

_03_ How 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. 01 [RFC 9110: HTTP Semantics](https://www.rfc-editor.org/rfc/rfc9110.html) rfc-editor.org · checked 2026-11-01
2. 02 [HTTP status codes in IIS 7.0 and later versions](https://learn.microsoft.com/en-us/troubleshoot/developer/webapps/iis/health-diagnostic-performance/http-status-code) learn.microsoft.com · checked 2026-11-01
3. 03 [FastCGI Application <application>](https://learn.microsoft.com/en-us/iis/configuration/system.webserver/fastcgi/application/) learn.microsoft.com · checked 2026-11-01
4. 04 [ASP.NET Core Module configuration (web.config)](https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/web-config) learn.microsoft.com · checked 2026-11-01
5. 05 [httpRuntime element (ASP.NET Settings Schema)](https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/e1f13641(v=vs.100)) learn.microsoft.com · checked 2026-11-01
6. 06 [Troubleshoot failed requests using tracing in IIS 7](https://learn.microsoft.com/en-us/iis/troubleshoot/using-failed-request-tracing/troubleshooting-failed-requests-using-tracing-in-iis) learn.microsoft.com · checked 2026-11-01
7. 07 [How HTTP status codes affect Google's crawlers](https://developers.google.com/crawling/docs/troubleshooting/http-status-codes) developers.google.com · checked 2026-11-01

## Keep learning

[All errors](/errors)

[Learn 504 Gateway Timeout HTTP status codes](/errors/http/504) [Related 5xx server errors Status codes and links](/seo-issues/server-errors-5xx) [Read next 504 Gateway Time-out in nginx HTTP status codes](/errors/http/504/nginx) [Do Run a free site audit Free, about two minutes](/site-audit)

Other 504 errors
[504 Gateway Time-out in nginx](/errors/http/504/nginx) [504 Gateway Timeout](/errors/http/504) [504 Gateway Timeout in Apache](/errors/http/504/apache) [ALB 504 Gateway Timeout](/errors/cdn/alb-504-gateway-timeout) [API Gateway 504 Gateway Timeout](/errors/cdn/api-gateway-504)

Nearby in errors
[505 HTTP Version Not Supported](/errors/http/505)

More in 504 Gateway Timeout
[504 Gateway Time-out in nginx](/errors/http/504/nginx) [504 Gateway Timeout in Apache](/errors/http/504/apache) [504 Gateway Timeout on IIS](/errors/http/504/iis)

Terms on this page
[HTTP status codes](/glossary/http-status-codes)

Free · 2 minutes

## Tools point. Agencies advise. _This one ships._

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

[Audit my site free](/site-audit)

Free, no card 60 seconds Nobody will call you

- **46** fixes shipped without a ticket Brightpipe
- **0→7** ChatGPT citations in six weeks Paylane
