首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

web API 异常处理The 'ObjectContent`1' type failed to serialize

2013-10-29 
web API 错误处理The ObjectContent`1 type failed to serializejust added this three lines in my WebAp

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

热点排行