C#中的WebApi响应Accept头,自动返回xml或者jsonGlobal.asax.cs中的Application_Start方法添加GlobalConfiguration.Configuration.Formatters.Clear(); GlobalConfiguration.Configuration.Formatters.Add(new XmlMediaTypeFormatter()); GlobalConfiguration.Configuration.Formatters.Add(new JsonMediaTypeFormatter());