2011-05-22 84 views
0

我在我的本地主機模式項目(服務器端)使用WCF Web服務,它工作正常如何連接到WCF的Web服務內部局域網

現在我需要從另一臺機器連接到這個服務相同的本地網絡

我應該在客戶端的配置文件中更改哪些內容?

我將客戶端的端點更改爲包含本地服務器且無法連接的計算機的IP!

<endpoint address="http://10.131.40.22:8732/Design_Time_Addresses/WcfServiceLibrary_Test/Service1/" 
       binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_RepositoryManager" 
       contract="onlineExchangeCenter.RepositoryManager" name="WSHttpBinding_RepositoryManager"> 
       <identity> 
        <dns value="localhost" /> 
       </identity> 
      </endpoint> 
+0

我還懷疑防火牆阻止了您嘗試使用的端口。 – tofutim 2011-05-22 08:04:08

回答

1

你會得到什麼錯誤?這個問題可能與防火牆有關。

我通常在服務器上公開一個MEX端點,然後通過SVCutil生成客戶端配置文件。

+0

好吧,似乎你是正確的防火牆,現在我有這個例外「來電者未通過服務認證」:( – 2011-05-22 08:13:14

0

首先 - 你需要一個新的端點添加到您的服務 - 爲您的企業局域網內部的連接,我會建議netTcpBinding

<service name="someservice" behaviorConfiguration="...."> 
    <endpoint name="existing" 
     address="......" 
     binding="wsHttpBinding" 
     contract="onlineExchangeCenter.RepositoryManager" /> 

    <!-- add this *NEW* netTcpBinding endpoint --> 
    <endpoint name="corporateLAN" 
     address="net.tcp://YourServer:7171/YourService/SomeUrl" 
     binding="netTcpBinding" 
     contract="onlineExchangeCenter.RepositoryManager" /> 
</service> 

一旦你有了這個之後,就應該更新您的客戶端 - 在Visual Studio中對服務參考進行「右鍵單擊」,然後選擇「更新服務參考」,或手動將此端點信息添加到客戶端配置中,以便您的客戶端現在可以連接到端點netTcp在你的服務器上。

NetTcp在局域網環境是偉大的,但使用需要的端口是開放的 - 如果你有你的公司環境內的任何防火牆或ISA服務器,則可能需要爲了打開這些端口這個工作

相關問題