开发者

Returning JSON from WCF Web API

The WCF Web API returns data either XML or JSON based on the Accept par开发者_运维百科ameter in the request header not considering whether we set ResponseFormat=WebMessageFormat.Json in the WebInvoke/WebGet attributes. Is this the correct behavior of the API or a bug?


WCF Web API ignores the ResponseFormat attribute. That attribute is just there because of an effort to be backward compatible with previous WCF REST efforts. The returned media type is based largely on the Accept header sent by the client.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜