使用Fiddler工具调试RESTFul WCF 服务的技巧及其问题

异常信息:

The incoming message has an unexpected message format ‘Raw’. The expected message formats for the operation are ‘Xml’, ‘Json’.

在使用Fiddler工具(可免费下载),测试RESTFul WCF 服务的POST方法时,出现了上述异常印象。

 

这时,记得需要在header中添加Content-Type指令,如下所示:

Content-Type: application/xml; charset=utf-8

或者Content-Type: text/xml

如果是传入JSON数据,则需要更改为:Content-Type: application/json; charset=utf-8


 


RESTFul WCF 服务返回结果:


 

参考链接:

免费抓包工具Fiddler的使用

 

 

posted on 2012-09-06 08:56  EntLib  阅读(914)  评论(0编辑  收藏  举报