Other 5xx codes
All HTTP status codes in ASP.NET Core
5xx Server error
The server does not support the HTTP version of the request.
In ASP.NET Core: Kestrel sends it for unknown versions in the request line. HttpClient's resilience handler retries it anyway.
The StatusCodes constant, HttpStatusCode enum name, reason phrase, class, and how EnsureSuccessStatusCode() and the standard resilience handler treat 505.
| Constant | StatusCodes.Status505HttpVersionNotsupported |
|---|---|
| HttpStatusCode | HttpStatusCode.HttpVersionNotSupported |
| Reason phrase | Kestrel sends HTTP Version Not Supported; HttpClient's ReasonPhrase is Http Version Not Supported |
| Class | 5xx, server error |
| IsSuccessStatusCode | false |
| EnsureSuccessStatusCode() | throws HttpRequestException: Response status code does not indicate success: 505 (Http Version Not Supported). |
| Standard resilience handler | retries it (treated as transient); retrying will not help here |
Results.StatusCode(StatusCodes.Status505HttpVersionNotsupported)
Results.Problem(statusCode: StatusCodes.Status505HttpVersionNotsupported, detail: "...")StatusCode(StatusCodes.Status505HttpVersionNotsupported)
Problem(statusCode: StatusCodes.Status505HttpVersionNotsupported, detail: "...")What Results.Problem(statusCode: 505) sends (with AddProblemDetails()), as application/problem+json:
{
"type": "https://tools.ietf.org/html/rfc9110#section-15.6.6",
"title": "HTTP Version Not Supported",
"status": 505,
"traceId": "0HNA1B2C3D4E5:00000001"
}A controller's Problem(statusCode: 505) sends the same body.
A bare StatusCode(505) in an [ApiController] also gets a ProblemDetails body automatically; Results.StatusCode(505) in a minimal API sends an empty body unless you add UseStatusCodePages().
Setup
// any Kestrel appRequest
GET /items HTTP/3.0
(over a plain TCP connection)Response (recorded)
HTTP/1.1 505 HTTP Version Not SupportedKestrel answers 505 for versions it does not speak on that connection.
Every response on this page was recorded from ASP.NET Core 10.0.12 on Kestrel in the Production environment; the HttpClient rows come from .NET 10.0.12 and Microsoft.Extensions.Http.Resilience 10.10.0.
All HTTP status codes in ASP.NET Core