Other 4xx codes
All HTTP status codes in ASP.NET Core
4xx Client error
The server cannot meet the Expect header of the request.
In ASP.NET Core: Rare. Kestrel only supports Expect: 100-continue.
The StatusCodes constant, HttpStatusCode enum name, reason phrase, class, and how EnsureSuccessStatusCode() and the standard resilience handler treat 417.
| Constant | StatusCodes.Status417ExpectationFailed |
|---|---|
| HttpStatusCode | HttpStatusCode.ExpectationFailed |
| Reason phrase | Kestrel sends Expectation Failed |
| Class | 4xx, client error |
| IsSuccessStatusCode | false |
| EnsureSuccessStatusCode() | throws HttpRequestException: Response status code does not indicate success: 417 (Expectation Failed). |
| Standard resilience handler | does not retry it |
Results.StatusCode(StatusCodes.Status417ExpectationFailed)
Results.Problem(statusCode: StatusCodes.Status417ExpectationFailed, detail: "...")StatusCode(StatusCodes.Status417ExpectationFailed)
Problem(statusCode: StatusCodes.Status417ExpectationFailed, detail: "...")What Results.Problem(statusCode: 417) sends (with AddProblemDetails()), as application/problem+json:
{
"type": "https://tools.ietf.org/html/rfc9110#section-15.5.18",
"title": "Expectation Failed",
"status": 417,
"traceId": "0HNA1B2C3D4E5:00000001"
}A controller's Problem(statusCode: 417) sends the same body.
A bare StatusCode(417) in an [ApiController] also gets a ProblemDetails body automatically; Results.StatusCode(417) in a minimal API sends an empty body unless you add UseStatusCodePages().
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