2014-01-24 79 views
2

在我的配置我的詳細地址如下net.tcp://127.0.0.1:1127/CalculatorService but when the error message is showing Cannot obtain Metadata from http://localhost:12659無法從HTTP獲取元數據://本地主機:12659

我有簡單的服務,TCP綁定和我從VS2010 IDE與WCF測試客戶端上運行我的服務,然後我正在此錯誤無法從http://localhost:12659

這裏獲取元數據是我的配置文件的詳細信息

<?xml version="1.0"?> 
<!--Copyright (c) Microsoft Corporation. All Rights Reserved.--> 
<configuration> 
    <system.serviceModel> 
     <services> 
      <service name="MyTcpActivation.CalculatorService" behaviorConfiguration="CalculatorServiceBehavior"> 

       <host> 
        <baseAddresses> 
         <add baseAddress="net.tcp://127.0.0.1:1127/CalculatorService/"/> 
        </baseAddresses> 
       </host> 

       <endpoint address="" 
       binding="netTcpBinding" bindingConfiguration="PortSharingBinding" 
       contract="MyTcpActivation.ICalculator"/> 

       <endpoint address="mex" 
       binding="mexTcpBinding" 
       contract="IMetadataExchange"/> 
      </service> 
     </services> 

     <bindings> 
      <netTcpBinding> 
       <binding name="PortSharingBinding" portSharingEnabled="true"> 
        <security mode="None"/> 
       </binding> 
      </netTcpBinding> 
     </bindings> 
     <!--For debugging purposes set the includeExceptionDetailInFaults attribute to true--> 
     <behaviors> 
      <serviceBehaviors> 
       <behavior name="CalculatorServiceBehavior"> 
        <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/> 
        <serviceDebug includeExceptionDetailInFaults="false"/> 
       </behavior> 
      </serviceBehaviors> 
     </behaviors> 
    </system.serviceModel> 
    <system.web> 
     <compilation debug="true"/></system.web> 

</configuration> 

請幫我從WCF測試客戶端上運行我的服務來自VS2010 IDE。謝謝

回答

4

這表明WCF上的激活問題。元數據在您的service/config/env中存在問題時不會公開。

要獲取錯誤消息,請嘗試在您的瀏覽器中打開http://localhost:12659和/或檢查事件日誌。

因爲它是一個nettcpbinding,所以配置有點複雜,特別是如果您在IIS下託管服務:檢查WAS服務是否已啓動,Net Tcp Listener服務已啓動,net.tcp處於您的Web的已激活協議站點,已配置的綁定在端口1127上與ntc.tcp相關,...)。你也可以先嚐試一個basicHttpBinding。

出於調試目的設置includeExceptionDetailInFaults屬性真正

<behaviors> 
     <serviceBehaviors> 
      <behavior name="CalculatorServiceBehavior"> 
       <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/> 
       <serviceDebug includeExceptionDetailInFaults="true"/> 
      </behavior> 
     </serviceBehaviors> 
    </behaviors> 
+0

我在WCF是新的。我檢查了Net Tcp Listener Service已啓動。我沒有託管在IIS或WAS中。我只是從VS2010 IDE開始測試的服務。所以當我從IDE運行我的服務時,爲什麼我需要啓動WAS。當我用IDE的httpbinding運行我的服務時,沒有問題發生。所以引導我做什麼。告訴我,當我不會部署到WAS時,總是需要啓動WAS。 – Thomas

+0

我提到我的端口1127,但在錯誤消息中端口號顯示12659爲什麼?你能告訴我爲什麼這麼有線的行爲。謝謝 – Thomas

+0

我的服務經理中沒有找到任何名爲WAS的服務。 – Thomas

相關問題