具有端口转发功能的WCF WSHttpBinding

时间:2019-03-03 13:48:48

标签: wcf load-balancing wshttpbinding wcf-wshttpbinding

我有一个客户端应用程序,它需要来自服务(服务器应用程序)的数据。在客户端和服务器之间,有一个负载平衡器,可将请求请求的端口从客户端重定向到服务器,而LB则无法处理从服务器到客户端的响应。

我不知道如何配置客户端/服务器,这样我才能发送请求并获得响应。

注意:没有LB,它就可以工作。

服务器配置:

  <system.serviceModel>
<bindings>
  <wsHttpBinding>
    <binding name="WSHttpBinding_IThirdPartyService" closeTimeout="22:01:00" openTimeout="22:10:00" receiveTimeout="22:10:00" sendTimeout="22:10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
      <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <reliableSession ordered="true" inactivityTimeout="22:10:00" enabled="false" />
      <security mode="Transport">
        <message clientCredentialType="None" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true" />
        <transport clientCredentialType="None" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>
<services>
  <service behaviorConfiguration="ThirdPartyWcfService.ThirdPartyServiceBehavior" name="ThirdPartyWcfService.ThirdPartyService">
    <endpoint binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IThirdPartyService" contract="ThirdPartyWcfService.IThirdPartyService" name="WSHttpBinding_IThirdPartyService">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:89097" />
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="ThirdPartyWcfService.ThirdPartyServiceBehavior">
      <serviceMetadata httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
    <behavior name="ThirdPartyWcfService.Service1Behavior">
      <serviceMetadata httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>

客户:

  <system.serviceModel>
<bindings>
  <wsHttpBinding>
    <binding name="WSHttpBinding_IThirdPartyService" closeTimeout="22:01:00" openTimeout="22:01:00" receiveTimeout="22:10:00" sendTimeout="22:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
      <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
      <reliableSession ordered="true" inactivityTimeout="22:10:00" enabled="false"/>
      <security mode="Transport">
        <message clientCredentialType="None" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true"></message>
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </wsHttpBinding>
</bindings>
<client>
  <endpoint address="https://localhost/ThirdPartyWcfService/ThirdPartyService.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IThirdPartyService" contract="IThirdPartyRACService" name="WSHttpBinding_IThirdPartyService">
    <identity>
      <dns value="localhost"/>
    </identity>
  </endpoint>
</client>

0 个答案:

没有答案