2011-03-28 51 views
8

我有兩個應用程序需要在同一臺計算機上進行本地測試。應用1具有與folloiwng config條目一個簡單的WCF服務:WCF - 「沒有端點正在偵聽......」錯誤

<service behaviorConfiguration="MyNamespace.ContainerManagementServiceBehavior" 
     name="MyNamespace.ContainerManagementService"> 
    <endpoint address="ContainerManagementService" binding="basicHttpBinding" 
    name="ContainerManagementbasicHttpEndpoint" 
    contract="MyNamespace.IContainer" /> 
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
    <host> 
    <baseAddresses> 
     <add baseAddress="http://localhost:8000/ContainerManagementService" /> 
    </baseAddresses> 
    </host> 
</service>  
<behaviors>  
    <behavior name="MyNamespace.ContainerManagementServiceBehavior"> 
    <serviceMetadata httpGetEnabled="true" /> 
    <serviceDebug includeExceptionDetailInFaults="false" /> 
    </behavior> 
</behaviors> 

我通過運行在那裏舉辦的Web應用程序項目啓動該服務。我能夠成功瀏覽到該網址並從ie獲取Web服務信息頁面。我複製相同的URL並將其用於我的客戶端。

我的其他客戶端,應用2,在它的配置文件如下:

<system.serviceModel> 
    <bindings> 
    <basicHttpBinding> 
     <binding name="basicHttp" closeTimeout="00:10:00" 
     openTimeout="00:10:00" receiveTimeout="00:10:00" 
     sendTimeout="00:10:00" allowCookies="false" 
     bypassProxyOnLocal="false" 
     hostNameComparisonMode="StrongWildcard" 
     maxBufferSize="5242880" maxBufferPoolSize="524288" 
     maxReceivedMessageSize="5242880" messageEncoding="Text" 
     textEncoding="utf-8" transferMode="Buffered" 
     useDefaultWebProxy="true"> 
     <readerQuotas maxDepth="32" maxStringContentLength="8192" 
      maxArrayLength="16384" 
      maxBytesPerRead="4096" maxNameTableCharCount="5242880" /> 
     <security mode="None"> 
      <transport clientCredentialType="None" 
      proxyCredentialType="None" realm="" /> 
      <message clientCredentialType="UserName" algorithmSuite="Default" /> 
     </security> 
     </binding> 
    </basicHttpBinding> 
    </bindings> 
    <client> 
    <endpoint 
     address="http://localhost:3227/Services/ContainerManagementService.svc" 
     binding="basicHttpBinding" bindingConfiguration="basicHttp" 
     contract="MyService.IService" name="externalService" />  
    </client> 
</system.serviceModel> 

然而,當我嘗試執行WCF的調用方式客戶正在運行的服務,我收到以下錯誤信息:

There was no endpoint listening at 
http://localhost:3227/Services/ContainerManagementService.svc 
that could accept the message. This is often caused by an incorrect 
address or SOAP action. See InnerException, if present, for more details. 

會發生什麼情況?

+30

歡迎來到WCF。 – 2012-04-17 19:43:19

回答

4

它看起來喜歡這個問題是由於一個事實,即服務器和客戶機正在從卡西尼服務器運行。我正在更改體系結構以在IIS中託管服務器端點。

3

你有兩個應用程序?

一個承載服務器端點,另一個是客戶端?都在IIS中活動(考慮第二個應用程序是一個Web應用程序)?

如果您的解決方案中有兩個項目用於這兩個組件,則可以配置VS以同時啓動兩個項目。通過這種方式,您可以在客戶端和服務器上都放置斷點,並查看服務器是否真的被客戶端調用,或者在沒有調用服務器方法的情況下發生異常。

+0

我有兩個單獨的解決方案,一個用於客戶端的服務器。解決方案同時運行。該服務器在IIS中處於活動狀態。 – laconicdev 2011-03-28 18:56:12

+0

如果你在svc.cs的方法中放置了一個斷點,斷點是否被命中,或者它永遠不會被調用?編輯:既然客戶端和服務器都在你的機器上,你可以讓它們從同一個VS調試會話開始,如果客戶端和服務器都在相同的解決方案中。如果不是,你可以爲了測試目的而制定解決方案。 – Gilles 2011-03-28 19:00:43

1

如果您的網絡服務是:http://localhost:8000/ContainerManagementService.svc

您的客戶端APP 2應指向這個相同ADDRES:

<client> 
     <endpoint address="http://localhost:8000/ContainerManagementService.svc" 
     binding="basicHttpBinding" bindingConfiguration="basicHttp" 
     contract="MyService.IService" name="externalService" />  
</client> 
+0

他最有可能在IIS中託管,因此,IIS將根據* .svc文件所在的地址來決定URL。 – 2011-03-28 19:07:42

+0

它不在http:// localhost:8000/ContainerManagementService.svc上,這使我想到另一個問題:它似乎元素在我的場景中被忽略。爲什麼?它在哪裏使用? – laconicdev 2011-03-28 19:17:19

相關問題