enable content negotiation json and xml
services.AddMvc(options => {
options.RespectBrowserAcceptHeader = true;
options.Filters.Add(new ProducesAttribute("application/xml"));//default to xml
})
.AddXmlDataContractSerializerFormatters();
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Xml" Version="1.1.3" />
[Produces("application/json")] //change default to json
public class Greetings : Controller
{
}