You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two different strings in two different files make you always to get FormatterNotFoundException "OutputFormatter not found for 'application/json; charset=utf-8'" error when to running MVC
Two different strings in two different files make you always to get FormatterNotFoundException "OutputFormatter not found for 'application/json; charset=utf-8'" error when to running MVC
ExamplesConverter.cs
private static readonly MediaTypeHeaderValue ApplicationJson = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
MvcOutputFormatter.cs
private string SerializeWithoutMvc(T value, MediaTypeHeaderValue contentType)
{
if (contentType.MediaType.Value == "application/json")
{
#if NET5_0_OR_GREATER
return System.Text.Json.JsonSerializer.Serialize(value,
new System.Text.Json.JsonSerializerOptions(System.Text.Json.JsonSerializerDefaults.Web));
#else
return System.Text.Json.JsonSerializer.Serialize(value);
#endif
}
throw new FormatterNotFoundException(contentType);
}
The text was updated successfully, but these errors were encountered: