Other 5xx codes
All HTTP status codes in ASP.NET Core
5xx Server error
A content negotiation configuration error on the server (RFC 2295).
In ASP.NET Core: Not used by typical APIs.
The StatusCodes constant, HttpStatusCode enum name, reason phrase, class, and how EnsureSuccessStatusCode() and the standard resilience handler treat 506.
| Constant | StatusCodes.Status506VariantAlsoNegotiates |
|---|---|
| HttpStatusCode | HttpStatusCode.VariantAlsoNegotiates |
| Reason phrase | Kestrel sends Variant Also Negotiates |
| Class | 5xx, server error |
| IsSuccessStatusCode | false |
| EnsureSuccessStatusCode() | throws HttpRequestException: Response status code does not indicate success: 506 (Variant Also Negotiates). |
| Standard resilience handler | retries it (treated as transient) |
Results.StatusCode(StatusCodes.Status506VariantAlsoNegotiates)
Results.Problem(statusCode: StatusCodes.Status506VariantAlsoNegotiates, detail: "...")StatusCode(StatusCodes.Status506VariantAlsoNegotiates)
Problem(statusCode: StatusCodes.Status506VariantAlsoNegotiates, detail: "...")What Results.Problem(statusCode: 506) sends (with AddProblemDetails()), as application/problem+json:
{
"title": "Variant Also Negotiates",
"status": 506,
"traceId": "0HNA1B2C3D4E5:00000001"
}A controller's Problem(statusCode: 506) sends a different body, because MVC only fills type and title for codes in ApiBehaviorOptions.ClientErrorMapping:
{
"status": 506,
"traceId": "0HNA1B2C3D4E5:00000001"
}A bare StatusCode(506) in an [ApiController] also gets a ProblemDetails body automatically; Results.StatusCode(506) 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