
var editedcourse = container.Courses.Where(c => c.CourseID == ID).SingleOrDefault();
这是错误:
<m:innererror> <m:message>The 'ObjectContent`1' type Failed to serialize the response body for content type 'application/atom+xml; charset=utf-8'.</m:message> <m:type>system.invalIDOperationException</m:type> <m:stacktrace></m:stacktrace> <m:internalexception> <m:message>'SingleResult`1' cannot be serialized using the ODataMediaTypeFormatter.</m:message> <m:type>System.Runtime.Serialization.SerializationException</m:type>解决方法 默认情况下,web.API控制器方法不可查询,因此客户端失败.添加了要修复的注释:[queryable(AllowedOrderByPropertIEs =“ID”)] 总结
以上是内存溢出为你收集整理的odata – 按键查询时,在Web API中不能序列化SingleResult全部内容,希望文章能够帮你解决odata – 按键查询时,在Web API中不能序列化SingleResult所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)