我遇到了WCF測試客戶端的問題。我無法連接到我的web服務,因爲它使達不到這個錯誤:WCF - 無法獲取元數據,但在移除XML端點時起作用?
Error: Cannot obtain Metadata from http://xxx.xxxxxxxx.xxx/DPITerminal.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://xxx.xxxxxxxx.xxx/DPITerminal.svc
Metadata contains a reference that cannot be resolved: 'http://xxx.xxxxxxxx.xxx/DPITerminal.svc'. Content Type application/soap+xml; charset=utf-8 was not supported by service http://xxx.xxxxxxxx.xxx/DPITerminal.svc . The client and service bindings may be mismatched. The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..HTTP GET Error URI: http://xxx.xxxxxxxx.xxx/DPITerminal.svc There was an error downloading 'http://xxx.xxxxxxxx.xxx/DPITerminal.svc'.
這裏是我的web.config:Link。
正如你所看到的,我已經有
<serviceMetadata httpGetEnabled="true" />
以及
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="mex" contract="IMetadataExchange" />
如其他StackOverflow的問題建議。仍然不起作用。
我還注意到,當我評論以下端點:
<endpoint address="x" behaviorConfiguration="poxBehavior" binding="webHttpBinding" bindingConfiguration="web" contract="xxx.xxxxxxxx.xxxxxx.WebService.IDPITerminal" />
一切正常。所以我想我的XML端點有問題?這很奇怪,因爲XML端點共享JSON端點的綁定配置,而JSON端點沒有任何問題。
此外,讓我澄清,我只有WCF測試客戶端的問題。 XML Endpoint的JSON &工作正常。
編輯:
我想評論的XML端點,發佈,然後通過WCF測試客戶端連接。然後我取消註釋了XML Endpoint,重新發布。 WCF測試客戶端仍然有效 - 我的意思是我可以發送和接收數據。當我刷新服務時,無法獲取元數據錯誤再次彈出。
我嘗試過了,它的工作。 WCF的行爲仍然非常奇怪。 – 2012-07-28 22:30:48