2011-01-21 204 views
1

我无法使用VS2010中提供的Wcf测试客户端测试WCF数据服务。常规服务工作正常,但随后的数据服务,我在尝试调用测试客户端的URL时,这个错误:使用WCF测试客户端测试WCF数据服务

Error: Cannot obtain Metadata from http://localhost:31745/MyWcfDataService.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: http://localhost:31745/MyWcfDataService.svc Metadata contains a reference that cannot be resolved: 'http://localhost:31745/MyWcfDataService.svc'. The remote server returned an unexpected response: (405) Method Not Allowed. The remote server returned an error: (405) Method Not Allowed.HTTP GET Error URI: http://localhost:31745/MyWcfDataService.svc The document at the url http://localhost:31745/MyWcfDataService.svc/ was not recognized as a known document type.The error message from each known type may help you fix the problem:- Report from 'XML Schema' is 'The root element of a W3C XML Schema should be and its namespace should be 'http://www.w3.org/2001/XMLSchema'.'.- Report from 'DISCO Document' is 'Discovery document at the URL http://localhost:31745/MyWcfDataService.svc/ could not be found.'. - The document format is not recognized.- Report from 'WSDL Document' is 'There is an error in XML document (2, 2).'. - was not expected.

数据服务运行良好,我能够做一个浏览器查看到有问题的svc文件并查看wsdl。

是wcf测试客户端不是意思是测试WCF数据服务?如果可以使用,那么我该如何去做呢?我需要做任何修改吗?

谢谢..

回答

4

的WcfTestClient只适用于SOAP绑定,例如basicHttpBindingwsHttpBindingnetTcpBinding

它不支持基于REST的WCF服务。

什么?您可以使用您喜欢的浏览器测试基于REST的服务 - 无需特殊的测试客户端!如果您需要进行像POSTPUT HTML请求,你应该检查出Fiddler

+0

尽管fiddler可以将输入注入到API中,但您无法真正使用fiddler对该接口进行正式测试。有没有简单的方法来通过/失败分析手动查看响应。 – DeepSpace101 2012-03-02 02:59:42

1

我的回答可能有点晚了,但你可以用LINQPad测试WCF数据服务(http://www.linqpad.net)支持的OData/WCF数据服务。