API清理xml格式数据

调用API时候,可能会报这个错  //The 'ObjectContent`1' type failed to serialize the response body for content type 'application/xml; charset=utf-8'.

解决办法是:

//处理方法 在API的webApiConfig-加此代码
GlobalConfiguration.Configuration.Formatters.XmlFormatter.SupportedMediaTypes.Clear();

posted @ 2018-09-10 12:02  逆水行舟-奕  阅读(231)  评论(0编辑  收藏  举报