Skip to content

asp core - output formatter warning #2238

@amirreza8002

Description

@amirreza8002

hi
i have an asp core project with this config:

builder
    .Services.AddControllersWithViews()
    .AddMvcOptions(option =>
    {
        option.OutputFormatters.Clear();
        option.OutputFormatters.Add(
            new MessagePackOutputFormatter(ContractlessStandardResolver.Options)
        );
        option.InputFormatters.Clear();
        option.InputFormatters.Add(
            new MessagePackInputFormatter(ContractlessStandardResolver.Options)
        );
    });

i'm sending post data via a client formatted as msgpack, and include the 'Content-Type': 'application/x-msgpack' header
and it works fine, until i do
return NotFound() in my asp controller
which gives a warning in logs:

[12:22:46 WRN] No output formatter was found for content types '["application/problem+json", "application/problem+xml", "application/problem+json", "application/problem+xml", "application/problem+xml"]' to write the response.

and returns a 406 code instead of 404
samething when i return StatusCode()

but returning Created, Ok, and BadRequest works fine

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions