2011-11-30 79 views
1

我想通過WCF測試客戶端使用WCF服務。雖然它是在同一臺機器工作正常,當我的WCF服務/主機和客戶端是在不同的機器上它給錯誤我的應用程序的無法從wcftestclient使用wcf服務

"Error: Cannot obtain Metadata from http://10.15.4.116:8000/hello 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://10.15.4.116:8000/hello
Metadata contains a reference that cannot be resolved: 'http://10.15.4.116:8000/hello'.
Content Type application/soap+xml; charset=utf-8 was not supported by service http://10.15.4.116:8000/hello . 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://10.15.4.116:8000/hello The document at the url http://10.15.4.116:8000/hello 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 document format is not recognized (the content type is 'text/html; charset=UTF-8').'.- Report from 'http://10.15.4.116:8000/hello' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.- Report from 'DISCO Document' is 'There was an error downloading 'http://localhost:8000/hello?disco'.'. - Unable to connect to the remote server - No connection could be made because the target machine actively refused it 127.0.0.1:8000- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'."

配置文件的部分是: -

<configuration> 
    <system.serviceModel> 
     <behaviors> 
     <serviceBehaviors> 
      <behavior name="SimpleServiceBehavior"> 
      <serviceMetadata httpGetEnabled="True" policyVersion="Policy12" /> 
      </behavior> 
     </serviceBehaviors> 
     </behaviors> 
    </system.serviceModel> 
    </configuration> 
+1

你能發佈你的完整配置以找出錯誤的原因嗎? – Rajesh

+0

在'內發佈**完整配置** - 這裏的這個片段並不是非常有用。最重要的是:你使用了哪個**綁定?看起來你可能使用'webHttpBinding'(REST風格),但WCF測試客戶端僅用於** SOAP **消息... –

+0

目前我的配置文件只包含這部分,請告訴我哪個綁定應該用於WCF測試客戶端 – funsukvangdu

回答

0

這是錯誤信息的結尾處顯示所有有關錯誤的信息:

無法處理消息,因爲內容類型爲'application/soap + xml; charset = utf-8'不是預期的類型'text/xml; charset = utf-8'

+0

如何在配置文件中處理它我沒有提到「application/soap + xml」 – funsukvangdu

+0

你似乎試圖以類似於網絡的方式訪問你的服務器(http:// localhost:8000/hello?disco),我顯然不知道所有關於WCF,但從我知道參數不是這樣發送... – GameAlchemist