调用odata返回406 not acceptable解决方案
在web api项目中使用odata时,总是返回406 not acceptable
根据
http://stackoverflow.com/questions/26676879/webapi-and-odatacontroller-return-406-not-available
和
http://stackoverflow.com/questions/26676879/webapi-and-odatacontroller-return-406-not-available/27191598#27191598
得到解决方案:
在Controller的代码中,把using System.Web.Http.OData;改成using System.Web.OData;
其他关于odata在.net中的使用:
Odata query:
http://www.odata.org/documentation/odata-version-2-0/uri-conventions/
http://www.odata.org/libraries/
http://www.nuget.org/packages/Microsoft.AspNet.OData/
http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/odata-v4/create-an-odata-v4-endpoint
https://msdn.microsoft.com/en-us/library/ff478141.aspx
http://jerther.blogspot.ca/2014/11/aspnet-web-api-2-help-pages-odata_28.html
http://www.codeproject.com/script/Articles/ArticleVersion.aspx?aid=634772&av=928984
时间: 2024-10-13 01:38:46