通过TCP传输方式连接WCF

来源:互联网 发布:算法时代 txt 编辑:程序博客网 时间:2024/05/17 21:57

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="netTcpBindConfig"
        closeTimeout="00:01:00"
        openTimeout="00:01:00"
        receiveTimeout="00:10:00"
        sendTimeout="00:01:00"
        transactionFlow="false"
        transferMode="Buffered"
        transactionProtocol="OleTransactions"
        hostNameComparisonMode="StrongWildcard"
        listenBacklog="10"
        maxBufferPoolSize="2147483647 "
        maxBufferSize="2147483647 "
        maxConnections="10"
        maxReceivedMessageSize="2147483647 ">
          <readerQuotas maxDepth="32"
          maxStringContentLength="2147483647 "
          maxArrayLength="2147483647 "
          maxBytesPerRead="4096"
          maxNameTableCharCount="16384" />
          <reliableSession ordered="true"
          inactivityTimeout="00:10:00"
          enabled="false" />
          <security mode="Transport">
            <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
          </security>
        </binding>
      </netTcpBinding>


    </bindings>
    <services>
      <!--添加服务-->    
     
      <!--net.tcp-->
      <service name="WcfService1.Service1" behaviorConfiguration="netTcpBehavior">
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:8000/"/>            
          </baseAddresses>
        </host>
        <endpoint address=""    binding="netTcpBinding" contract="WcfService1.IService1" bindingConfiguration="netTcpBindConfig"></endpoint>        
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" ></endpoint>
      </service>
     
    </services>
    <!--定义CalculatorServiceBehavior的行为-->
    <behaviors>
      <serviceBehaviors>
        <behavior name="netTcpBehavior">
          <serviceMetadata httpGetEnabled="false"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
        
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

 

0 0