2013-10-28 58 views
1

我一直在尋找解決方案來解決我的問題,嘗試了各種建議,但到目前爲止還沒有人爲我工作。從局域網中的另一臺計算機訪問我的WCF服務

我可以在本地完美地訪問WCF服務,但似乎無法從正常LAN網絡中的另一臺計算機訪問它。

注意:我不是WCF的專家,但在研究中做了我公平的分享。我嘗試了不同的綁定,netTcpBinding不適用於我,因爲我得到了不支持的錯誤。

另外,我的防火牆已關閉,所以我很確定它不是防火牆問題,而我是Visual Studio的內置Web服務器,我不知道如何通過IIS託管它,或者在哪裏開始這樣做。

<system.serviceModel> 
<services> 
    <service name="WCFService.TorrentService"> 
    <endpoint contract="WCFService.ITorrentService" 
       address="TorrentService" 
       binding="basicHttpBinding"> 
    </endpoint> 
    <endpoint address="TorrentService/MEX/" 
       binding="mexHttpBinding" 
       contract="IMetadataExchange"> 
    </endpoint> 
    <host> 
     <baseAddresses> 
     <add baseAddress="http://192.168.7.111:3697/TorrentService"/> 
     </baseAddresses> 
    </host> 
    </service> 
</services> 
<behaviors> 
    <serviceBehaviors> 
    <behavior> 
     <!-- To avoid disclosing metadata information, set the values below to false before deployment --> 
     <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/> 
     <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
     <serviceDebug includeExceptionDetailInFaults="false"/> 
     <useRequestHeadersForMetadataAddress> 
     <defaultPorts> 
      <add scheme="http" port="3697" /> 
     </defaultPorts> 
     </useRequestHeadersForMetadataAddress> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 
<protocolMapping> 
    <add binding="basicHttpBinding" scheme="https" /> 
</protocolMapping>  
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> 

Im相當肯定有很多的東西那不是應該在那裏的配置文件,因爲我已經嘗試了很多不同的解決方案,但至今沒有一個爲我工作。

當我嘗試從另一臺計算機訪問該服務,通過執行以下操作

http://s8.postimg.org/yqps7k6f9/untitled.png
http://s8.postimg.org/yqps7k6f9/untitled.png

+0

[本地網絡中的WCF服務]的可能的重複(http://stackoverflow.com/questions/15421518/wcf-service-in-local-network) –

+0

你將有更好的運氣將您的錯誤粘貼爲文本而不是作爲圖像,但我會爲你修復你的圖像。 – gunr2171

+0

您需要將您的服務發佈到IIS –

回答

0

如果您的WCF在本地主機工作,所以問題是與其他機器共享。我相信你正在使用標準的開發服務器或IIS Express。將所需文件存檔的一種方法是使用IIS Express,並按照下一篇文章http://johan.driessen.se/posts/Accessing-an-IIS-Express-site-from-a-remote-computer

一旦你爲IIS Express和你機器上的安全進行了所有必要的設置,我相信你會得到wcf服務的評估。但嘗試兩種方法:使用IP地址和計算機名稱!

+1

我建議您添加步驟或設置,stackoverflow不喜歡鏈接 –

-2

請啓動您的項目,然後從另一臺機器訪問。在從另一臺機器訪問主機服務之前,主機服務應該正在運行。

相關問題