I am unable to test a WCF Data service using the Wcf test client provided in VS2010. A regular service works fine but then for a data service I get this error when trying to call the url in the test client:
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 MSD开发者_JS百科N 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.
The data service is running fine and I am able to do a View in browser to the svc file in question and see the wsdl.
Was wcf test client not meant to test WCF Data services? If it can be used, then how do I go about doing it? Do I need to make any modifications?
Thanks..
The WcfTestClient only works with SOAP bindings, e.g. basicHttpBinding
, wsHttpBinding
, netTcpBinding
.
It does not support REST based WCF services.
What for?? You can test your REST based services using your favorite browser - no special test client needed! If you need to carry out HTML requests like a POST
or PUT
, you should check out Fiddler
My answer might be a bit late, but you could test your WCF data service with LINQPad (http://www.linqpad.net) which supports OData / WCF Data Services.
精彩评论