2013-01-15 83 views
0

我有兩個端點的服務。一個端點用於wsdual綁定,另一個用於tcp綁定。當我與開始我的WCF服務wcfsvchost.exe在多個端點的客戶端創建WCF代理

WcfSvcHost.exe /service:"C: 
\Users\TRIDIP\Documents\Visual Studio 2010\Projects\BBAChatService\BBAChatService\bin 
\BBAChatService.dll" /config:"C:\Users\TRIDIP\documents\visual studio 2010\Projects 
\BBAChatService\BBAChatService\Web.config" 

然後我的服務已啓動。

問題是,當我嘗試在WcfSvcHost.exe啓動服務後,在客戶端創建代理,然後所有終端相關的信息被添加到客戶端的配置文件中,但我希望當我將創建代理與TCP mex端點或mexHttpBinding從客戶端,那麼只有有效的端點應該添加到客戶端的配置文件中,而不是所有的端點。所以引導我在服務端的配置文件中更改什麼。這裏是我的配置文件在服務端....請看看。

<service name="BBAChatService.ChatService" behaviorConfiguration="BBAChatService.ChatServiceBehavior" > 
     <host> 
      <baseAddresses> 
      <add baseAddress ="http://localhost:8732/ChatService.svc/"/> 
      <add baseAddress ="net.tcp://localhost:7998/ChatService/"/> 
      </baseAddresses> 
     </host> 

     <endpoint name="dual_bind" 
        address="dual" 
        binding="wsDualHttpBinding" 
        bindingConfiguration="WSDualHttpBinding_IChatService" 
        contract="BBAChatService.IChatService"> 
     </endpoint> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 

     <endpoint name="tcp_bind" 
       address="tcp" 
       binding="netTcpBinding" 
       bindingConfiguration="tcpBinding" 
       contract="BBAChatService.IChatService"> 
     </endpoint> 

     <endpoint address="net.tcp://localhost:7996/ChatService/mex" 
          binding="mexTcpBinding" 
          contract="IMetadataExchange"/> 


     </service> 

指導我在我的配置中更改什麼。謝謝

+0

我不確定這是否可能。當在這裏隱藏一個端點時,確實需要它們的客戶端不能再生成代理類。您無法控制消費者使用的「工具」。 – Aphelion

回答

1

如果在同一服務中公開多個端點,那麼WSDL中有多個端口,並且svcutil(添加服務引用)將爲每個提供的端口導入配置。 WSDL始終公開服務的所有已定義端點,並且svcutil與它們一起工作。

您必須手動修改客戶端配置以刪除客戶端上的HTTP端點配置,或者必須將您的服務分成兩個不同的實現,每個實現都使用單個端點。