2013-05-30 25 views
2

Ithis問題已被反覆詢問,但無論解決方案在人們的項目中如何,它都不適用於我。WsDualHttpBinding不回撥客戶端,及時處理問題

我有一個WsDualHttpBinding從客戶端調用服務。我的客戶端的配置是這樣的:

<bindings> 
    <wsDualHttpBinding> 
    <binding name="wsDualHttpBindingConfiguration" closeTimeout="00:01:00" 
     openTimeout="00:01:00" receiveTimeout="00:05:00" bypassProxyOnLocal="true" /> 
    </wsDualHttpBinding> 
</bindings> 

我的客戶都是這樣有點進一步界定:

<client> 
     <endpoint address="http://{ipadress}:60379/ConfigurationCompleterService.svc" 
      binding="wsDualHttpBinding" bindingConfiguration="wsDualHttpBindingConfiguration" 
      contract="InfluxConfigurationCompleterService.IConfigurationCompleterService" 
      name="WSDualHttpBinding_IConfigurationCompleterService"> 
      <identity> 
       <userPrincipalName value="{domain-username}" /> 
      </identity> 
     </endpoint> 
     <!--wsDualHttpBindingConfiguration--> 
     <endpoint address="http://{ipadress}:60379/ConfigurationImportService.svc" 
      binding="wsDualHttpBinding" bindingConfiguration="wsDualHttpBindingConfiguration" 
      contract="ConfigurationImportServiceReference.IConfigurationImportService" 
      name="WSDualHttpBinding_IConfigurationImportService"> 
      <identity> 
       <userPrincipalName value="{domain-username}" /> 
      </identity> 
     </endpoint> 
    </client> 

這項工作在本地模式下,在同一臺機器上。當我在服務器上部署服務並啓動我的客戶端時,我會在1分鐘超時後收到以下錯誤消息:

未處理的異常:System.ServiceModel.CommunicationException:安全協商失敗,因爲遠程方沒有發回應答及時。這可能是因爲底層傳輸連接被中止。

我知道問題要麼是因爲端口(但在這裏我特別在80以外的部署)或安全問題。

所以我試圖插入安全屬性,以我的綁定配置:

<security mode="none" />

<security mode="message"><message clientCredentialType="None"/></security> 

和其他人,我不記得了。 即使在同一臺機器上,我仍然無法使用我的服務,只要我在VS2012上正常工作時就部署了它。

我的服務很好,我可以通過網絡瀏覽器和遠程機器訪問他們。

在此先感謝。

PS:有什麼辦法以絕對不安全的方式配置WsDualHttpBinding,那根本不會問任何憑證?

回答

0

我有同樣的問題,但這是因爲我的客戶端代碼。例如:

WSDualHttpBinding binding = new WSDualHttpBinding(); 
binding.Security.Mode = WSDualHttpSecurityMode.None; <-- I forgot this line. 
EndpointAddress endpoint = new EndpointAddress("http://localhost/CardService.svc"); 
DuplexChannelFactory<ICardService> channelFactory = new DuplexChannelFactory<ICardService>(this, binding, endpoint); 
ICardService channel = channelFactory.CreateChannel(); 
string message = "Hello, service."; 
Console.WriteLine("Successfully created the channel. Pinging it with message \"{0}\".", message); 
channel.Ping(message); 
Console.WriteLine("Successfully pinged the channel.");