总结下自己走过的坑
1、客户端和服务器端的配置文件一定要设置成一样的,否则就是不能通讯。
2、IP和端口就不用说了,必须要使用服务器的IP和端口
3、再就是权限问题
<system.serviceModel>
<services>
<service name="TakeImageWCFService.MyWCFService">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="defaultBinding" contract="TakeImageWCFService.IWCFservice" >
<identity>
<dns value="192.168.2.1" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://192.168.2.1:7107/MyWCFService.svc" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- 为避免泄漏元数据信息,
请在部署前将以下值设置为 false -->
<serviceMetadata httpGetEnabled="False"/>
<!-- 要接收故障异常详细信息以进行调试,
请将以下值设置为 true。在部署前设置为 false
以避免泄漏异常信息 -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="defaultBinding" receiveTimeout="00:59:00"
sendTimeout="00:59:05" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="None">
<transport clientCredentialType="None"/>
<message clientCredentialType="None"/>
</security>
</binding>
</netTcpBinding>
</bindings>
<!--<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="0" />-->
</system.serviceModel>
</configuration>