web API 错误处理The 'ObjectContent`1' type failed to serialize
just added this three lines in my WebApiConfig.cs file...
var json = config.Formatters.JsonFormatter;
json.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects;config.Formatters.Remove(config.Formatters.XmlFormatter);
After this codes were added.the Return XML will be transferred to Json format