WCF WSHttpBinding с переадресацией портов - PullRequest
0 голосов
/ 03 марта 2019

У меня есть клиентское приложение, которому требуются данные от службы (серверное приложение).Между клиентом и сервером существует балансировщик нагрузки, который перенаправляет порты для запросов от клиента к серверу, в то время как 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>

...