How can I have my vnext API to return XML and JSON ?
I thought that using content-type with application/xml would work as it was before. Note that I tryed with Accep
Here is the updated answer for MVC6 rc1
Startup.cs (using MvcXmlMvcBuilderExtensions)
public void ConfigureServices(IServiceCollection services)
{
var mvcBuilder = services.AddMvc();
mvcBuilder.AddXmlSerializerFormatters();
// or mvcBuilder.AddXmlDataContractSerializerFormatters()
project.json
"dependencies": {
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.Formatters.Xml": "6.0.0-rc1-final",
Don't forget as ASP.NET 5 was renamed to ASP.NET Core 1.0 and so Microsoft.AspNet.Mvc
became Microsoft.AspNetCore.Mvc i.e.
"dependencies": {
"Microsoft.AspNetCore.Mvc" : "1.0.2",
"Microsoft.AspNetCore.Mvc.Formatters.Xml" : "1.0.2",