Other 5xx codes
All HTTP status codes in ASP.NET Core
5xx Server error
The server does not support the functionality needed, such as an unknown method.
In ASP.NET Core: Retrying never helps, yet HttpClient's standard resilience handler retries it.
The StatusCodes constant, HttpStatusCode enum name, reason phrase, class, and how EnsureSuccessStatusCode() and the standard resilience handler treat 501.
| Constant | StatusCodes.Status501NotImplemented |
|---|---|
| HttpStatusCode | HttpStatusCode.NotImplemented |
| Reason phrase | Kestrel sends Not Implemented |
| Class | 5xx, server error |
| IsSuccessStatusCode | false |
| EnsureSuccessStatusCode() | throws HttpRequestException: Response status code does not indicate success: 501 (Not Implemented). |
| Standard resilience handler | retries it (treated as transient); retrying will not help here |
Results.StatusCode(StatusCodes.Status501NotImplemented)
Results.Problem(statusCode: StatusCodes.Status501NotImplemented, detail: "...")StatusCode(StatusCodes.Status501NotImplemented)
Problem(statusCode: StatusCodes.Status501NotImplemented, detail: "...")What Results.Problem(statusCode: 501) sends (with AddProblemDetails()), as application/problem+json:
{
"type": "https://tools.ietf.org/html/rfc9110#section-15.6.2",
"title": "Not Implemented",
"status": 501,
"traceId": "0HNA1B2C3D4E5:00000001"
}A controller's Problem(statusCode: 501) sends the same body.
A bare StatusCode(501) in an [ApiController] also gets a ProblemDetails body automatically; Results.StatusCode(501) 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