web API 错误处理The 'ObjectContent`1' type failed to serialize
2013-10-28 16:24
465 查看
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
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
相关文章推荐
- 错误整理:Unable to add module to the current project as it is not of packaging type 'pom'
- BizTalk Exception: Cannot access a disposed object && Failed to serialize the message part "BankQuoteRequest" into the type "BankQuoteRequest"
- iOS--错误集锦--Failed to instantiate the default view controller for UIMainStoryboardFile 'Main'
- TypeError: 'numpy.ndarray' object is not callable错误的处理办法
- mysqladmin: connect to server at 'localhost' failed初始化密码时的错误处理
- android Failed to install *.apk on device 'emulator-5554' timeout 或者 the user data image is used解决办法
- Unable to get value of the property '2': object is null or undefined
- Pointer to non-const type 'PLTexture*'with no explicit ownership错误,解决办法
- MYSQL登录错误:mysqladmin: connect to server at 'localhost' failed
- github commit 报错:error: failed to push some refs to 'https:'错误解决方法
- windows安装Apache,注册服务出现“(OS 5)拒绝访问。 : AH00369: Failed to open the WinNT service manager..."错误
- Failed to instantiate the default view controller for UIMainStoryboardFile 'Main1' - perhaps the des
- Swift中推送通知设置:Binary operator '|' cannot be applied to two UIUserNotificationType operands 错误解决
- MySQL server version for the right syntax to use near 'type=InnoDB' at line 1
- 使用Buildozer部署时,出现AttributeError: 'NoneType' object has no attribute 'group'错误的解决
- 错误:created a ThreadLocal with key of type ……but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
- Unable to cast COM object of type 'System.__ComObject' to class type 的解决办法
- Error occurred in deployment step 'Add Solution': Failed to extract the cab file in the solution
- Failed to convert property value of type 'java.util.Properties' to required type 'org.springframewor
- spring Failed to convert property value of type 'java.lang.String' to required type 'int' for proper