自己通过编写WCF服务端,在客户端直接添加服务引用时发现不能引用对netTcpBinding直接引用(net.tcp://127.0.0.1:8081),所以自己找到方法了记录以备不时之需。

服务端配置:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="mexConfig">
          <serviceMetadata httpGetEnabled="true" httpGetUrl="http://120.25.160.17:8080/" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <netTcpBinding>
        <binding name="MyTcpBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" sendTimeout="00:30:00" transferMode="Streamed"   >
          <security mode="None"></security>
        </binding>
      </netTcpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="mexConfig" name="WCFService.Service">
        <endpoint address="net.tcp://120.25.160.17:8081/" binding="netTcpBinding"
          bindingConfiguration="MyTcpBinding" contract="WCFService.IService" />
        <endpoint address="net.tcp://120.25.160.17:8081/" binding="netTcpBinding"
          bindingConfiguration="MyTcpBinding" contract="WCFService.IMyName" />
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://120.25.160.17:8081/" />
          </baseAddresses>
        </host>
      </service>
    </services>
  </system.serviceModel>
</configuration>
View Code

相关文章:

  • 2021-10-30
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
  • 2021-06-08
  • 2021-05-27
猜你喜欢
  • 2022-12-23
  • 2021-06-29
  • 2022-12-23
  • 2021-09-14
  • 2022-12-23
  • 2021-09-02
  • 2021-11-18
相关资源
相似解决方案