WCF 配置节点HTTP与TCP

1 HTTP绑定

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <!--对应<endpoint address="" binding="basicHttpBinding"-->
        <binding name="bindingConfig" closeTimeout="00:30:00" openTimeout="00:30:00" receiveTimeout="00:30:00" sendTimeout="00:30:00" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
            maxBufferPoolSize="2147483647" maxBufferSize="2147483647"  maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <!--第2处修改:None-->
          <security mode="None">
            <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service  behaviorConfiguration="TestBehaviors" name="SyncMsgServer.CallbackMsgService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="bindingConfig" name="Endpoint1" contract="SyncMsgServer.ICallbackMsgService">
          <identity>
            <!--第1处修改原来为:localhost,更改为公网IP111.17.168.98,现改为:http://tanzhen.cddlg.com/Service.svc-->
            <dns value="111.17.168.98" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" name="Endpoint2" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://cj.cddlg.com/CallbackMsgService.svc" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior  name="TestBehaviors">
          <!-- 为避免泄漏元数据信息,请在部署前将以下值设置为 false 并删除上面的元数据终结点 -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- 要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息-->
          <serviceDebug includeExceptionDetailInFaults="false"/>
          <serviceThrottling maxConcurrentCalls="1000" maxConcurrentSessions="1000" maxConcurrentInstances="1000" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

2 TCP绑定


 <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="metadataBehavior">
          <serviceMetadata httpGetEnabled="false"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <netTcpBinding>
        <binding name="netTcpBindingConfiguration">
          <readerQuotas maxDepth="64" 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>
      <service name="Services.MyService" behaviorConfiguration="metadataBehavior">
        <endpoint address="MyService"  binding="netTcpBinding" contract="Contracts.IService" bindingConfiguration="netTcpBindingConfiguration"  />
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:9999/"/>
          </baseAddresses>
        </host>
      </service>
    </services>
  </system.serviceModel>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值