2011-01-21 203 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數據服務。