【发布时间】:2020-06-16 15:09:55
【问题描述】:
我有一个 Web API OData 项目,一切正常。我现在尝试使用 $format 参数返回 xml 而不是 JSON,而不是指定标头请求,但它不起作用。我试过这些方法:
http://localhost:3845/api/Customer?$format=application/xml
http://localhost:3845/api/Customer?$format=xml
http://localhost:3845/api/Customer?$format=application/xml;odata.metadata=full
一切都没有成功。这篇文章说有可能:https://blogs.msdn.microsoft.com/webdev/2014/03/13/getting-started-with-asp-net-web-api-2-2-for-odata-v4-0/
我已经更新了我所有的 NuGet 包,但似乎总是忽略该请求,而是每次都得到 JSON。
【问题讨论】:
标签: asp.net-web-api odata