1. 程式人生 > >API清理xml格式數據

API清理xml格式數據

調用 處理方法 Matter con char serialize 數據 support edi

調用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();

API清理xml格式數據