502.1
- Meaning
- CGI application timeout
- Why it matters here
- A CGI process ran past its limit
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.
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).
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
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: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/slowIf 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.
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.
<fastCgi>
<application fullPath="C:\PHP\php-cgi.exe" arguments="" maxInstances="4"
idleTimeout="300" activityTimeout="30" requestTimeout="90"
instanceMaxRequests="10000" protocol="NamedPipe" flushNamedPipe="false" />
</fastCgi><system.webServer>
<aspNetCore processPath="dotnet" arguments=".\MyApp.dll"
requestTimeout="00:05:00" />
</system.webServer><system.web>
<httpRuntime executionTimeout="300" />
</system.web>| 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 |
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.
Use curl -w "%{time_total}" against IIS directly, then through the front layer, and compare the times.
Find the module or handler where the time elapses, then tune that layer rather than the whole stack.
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.
3 questions people ask next, answered from the sources on this page.
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.
requestTimeout defaults to 90 seconds. activityTimeout defaults to 30 on IIS 7.0 and 70 on IIS 7.5, per Microsoft's documentation.
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.
Run the free audit, then approve the fixes. Every change can be undone.