2014-12-03 74 views
0

我在使用svcutil工具爲我的應用程序創建WCF客戶端庫時出現以下錯誤。我可以在本地機器上成功執行相同的操作,但不能在裝有IIS的服務器上執行。WCF metedata下載問題

C:\Program Files (x86)\Microsoft Visual Studio 12.0>svcutil.exe http://beanie.elasticbeanstalk.com/beanie/beanie.svc?wsdl Microsoft (R) Service Model Metadata Tool [Microsoft (R) Windows (R) Communication Foundation, Version 4.0.30319.33440] Copyright (c) Microsoft Corporation. All rights reserved.

Attempting to download metadata from ' http://beanie.elasticbeanstalk.com/ beanie_deploy/beanie.svc?wsdl' using WS-Metadata Exchange or DISCO. Microsoft (R) Service Model Metadata Tool [Microsoft (R) Windows (R) Communication Foundation, Version 4.0.30319.33440] Copyright (c) Microsoft Corporation. All rights reserved.

Error: Cannot obtain Metadata from http://beanie.elasticbeanstalk.com/beanie_deploy/beanie.svc?wsdl

If this is a Windows (R) Communication Foundation service to which you have acce ss, please check that you have enabled metadata publishing at the specified addr ess. For help enabling metadata publishing, please refer to the MSDN documentat ion at http://go.microsoft.com/fwlink/?LinkId=65455 .

WS-Metadata Exchange Error URI: http://beanie.elasticbeanstalk.com/beanie_deploy/beanie.svc?wsdl

Metadata contains a reference that cannot be resolved: 'http://beanie 

.elasticbeanstalk.com/beanie_deploy/beanie.svc?ws dl'.

Content Type application/soap+xml; charset=utf-8 was not supported by servic e 

http://beanie.elasticbeanstalk.com/beanie_deploy/beanie.svc?wsdl . The client and service bindings may be mismatched.

The remote server returned an error: (415) Cannot process the message becaus e the content type 'application/soap+xml; 

charset=utf-8' was not the expected ty pe 'text/xml; charset=utf-8'..

HTTP GET Error URI: http://beanie.elasticbeanstalk.com/beanie_deploy loy/beanie.svc?wsdl

The document was understood, but it could not be processed. 

- The WSDL document contains links that could not be resolved. - There was an error downloading 'http:// win-iu76ruu909k /beanie_deploy/beanie.svc?xsd=xsd0'. - The remote name could not be resolved: 'win-iu76ruu909k'

If you would like more help, type "svcutil /?"

我該如何開始修復它們?

EDIT:web.config file

<behaviors> 
    <serviceBehaviors> 
    <behavior name="NewBehavior0"> 
     <serviceMetadata httpGetEnabled="true" /> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 

<services> 
    <service behaviorConfiguration="NewBehavior0" name="Syncre_LayerAB_WebService.LayerAB_WebService"> 
    <endpoint address="" binding="basicHttpBinding" 
     bindingConfiguration="" contract="Syncre_LayerAB_WebService.ILayerAB_WebService" /> 
    </service> 
</services> 

+0

沒有來自服務器上WCF服務的節點,很難弄清楚什麼可能是錯誤的。 – 2014-12-03 10:20:56

+0

謝謝,我只是做了編輯 – nikk 2014-12-03 17:56:30

回答

1

您的服務已正確配置爲發佈其元數據,但我懷疑問題在於IIS設置。例如,可以將安全性配置爲在服務使用匿名訪問時使用Ntlm或基本身份驗證。

「charset = utf-8」不是預期的類型'text/xml'「錯誤表示IIS正在返回錯誤消息而不是元數據。嘗試在瀏覽器中打開svc url(http://beanie.elasticbeanstalk.com/beanie/beanie.svc)以查看錯誤消息。

您可能還必須禁用IIS的自定義錯誤功能才能看到真實的錯誤消息,而不是通用錯誤消息。

<configuration> 
    <system.web> 
    <customErrors mode="Off" /> 
    </system.web> 
</configuration>