WCF雙工通訊外網無法串連

來源:互聯網
上載者:User

由於項目需要把WCF部署外網,在公司完成程式,測試沒有問題,wsDualHttpBinding 雙工通訊

用戶端配置:

<system.serviceModel>    <bindings>      <wsDualHttpBinding>        <binding name="hhh_IBLLServiceContract" closeTimeout="00:01:00"            openTimeout="00:51:00" receiveTimeout="00:50:00" sendTimeout="00:51:00"            bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"            maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"            messageEncoding="Mtom" textEncoding="utf-8" useDefaultWebProxy="true">          <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647"              maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />          <reliableSession ordered="true" inactivityTimeout="00:50:00" />          <security mode="None">            <message clientCredentialType="Windows" negotiateServiceCredential="true" />          </security>        </binding>      </wsDualHttpBinding>    </bindings>    <client>      <endpoint address="http://192.168.9.29:8081/Service1.svc"          binding="wsDualHttpBinding" bindingConfiguration="hhh_IBLLServiceContract"          contract="IBLLServiceContract" name="hhh_IBLLServiceContract">             </endpoint>    </client>  </system.serviceModel>

 

伺服器端配置:

 

<system.serviceModel>    <bindings>      <wsDualHttpBinding>        <binding name="hhh" messageEncoding="Mtom">          <security mode="None"/>        </binding>      </wsDualHttpBinding>    </bindings>    <services>      <service behaviorConfiguration="serviceBehavior" name="RNOP.WCF.Service.BLLService">        <endpoint address="Service1.svc"          binding="wsDualHttpBinding" bindingName="hhh" bindingConfiguration="hhh" contract="RNOP.WCF.ServiceInterface.IBLLServiceInterface" >        </endpoint>        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" >        </endpoint>        <host>          <baseAddresses>            <add baseAddress="http://192.168.9.180:8081/" />          </baseAddresses>        </host>      </service>    </services>    <behaviors>      <serviceBehaviors  >        <behavior name="serviceBehavior">          <serviceMetadata httpGetEnabled="true" />          <serviceDebug includeExceptionDetailInFaults="False" />          <dataContractSerializer maxItemsInObjectGraph="2147483647" />        </behavior>      </serviceBehaviors>    </behaviors>  </system.serviceModel>

 

內網測試沒有問題,部署到外網,就報逾時異常operation may have been a portion of a longer timeout

檢查伺服器和用戶端防火牆是否關閉,防火牆都關閉,依然串連失敗;

檢查連接埠是否被佔用,更換連接埠,錯誤依然;

探索服務的網頁上中繼資料地址使用的是電腦名稱,而電腦名稱在外網是無法訪問,於是搜尋,在網上發現一篇文章:http://www.cnblogs.com/lensso/archive/2011/08/01/2124095.html

遠程用戶端由於中繼資料地址主機名稱為伺服器電腦名稱而無法解析WCF服務中繼資料的解決辦法

安裝文章方法解決的了中繼資料的位址解析問題。

但是用戶端依然無法串連服務端,再次

http://www.cnblogs.com/bryant/archive/2011/09/22/2185621.html

http://social.msdn.microsoft.com/Forums/en-US/wcfzhchs/thread/0d663107-b47e-464b-82dc-6f191c484870

所以在外網的情況下,程式能正常的工作必須確保:1.用戶端沒安裝IIS6以下的版本,即80連接埠要被空出來;2是在違反1的條件下,80連接埠被佔用,讓你的clientBaseAddress能被伺服器所識別。

於是設定地址,用戶端正常串連上服務端,問題解決。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.