2010-09-03 31 views
3

我之前没有部署在负载平衡器后面。我的客户使用相对直接的服务模型配置在服务器上构建并测试了WCF服务。它提供了一项服务来返回另一个应用程序的地图图像。要获取地图,它会调用其他服务。如何配置调用负载均衡器后面的其他服务的WCF服务?

该服务是在Visual Studio 2010中构建的,目标是3.5框架。客户使用IIS 7.5和F5负载均衡器。当移动到生产服务器,在Web.config改为添加负载平衡器的行为,并指定端点,以显示该服务的物理和逻辑地址:

 <services> 
     <service behaviorConfiguration="Service.Service1Behavior" name="StaticMapImageService.Data.MapImageService"> 
     <endpoint 
       address="https://gis.customer.com/StaticMapImage/Service/StaticMapImageService.svc" 
       binding="basicHttpBinding" 
       bindingNamespace="http://customer.com" 
       contract="StaticMapImageService.Data.IMapImageService" 
       listenUri="http://hq-gis01.customer.net/StaticMapImage/Service/StaticMapImageService.svc" 
       behaviorConfiguration="SSLLoadBalancerBehavior"> 
     </endpoint> 
     <endpoint 
       address="mex" 
       binding="mexHttpBinding" 
       bindingNamespace="http://werner.com" 
       contract="IMetadataExchange"/> 
     </service> 
    </services> 

没有在这个服务没有入口system.servicemodel/bindings部分。其他服务在绑定和客户端部分配置:

 <bindings> 
     <basicHttpBinding> 
     <binding name="BasicHttpBinding_IAddressVerificationService" 
      closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" 
      sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" 
      hostNameComparisonMode="StrongWildcard" maxBufferSize="999999999" 
      maxBufferPoolSize="524288" maxReceivedMessageSize="999999999" 
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
      useDefaultWebProxy="true"> 
      <readerQuotas maxDepth="32" maxStringContentLength="999999999" maxArrayLength="16384" 
       maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
      <security mode="None"> 
      <transport clientCredentialType="None" proxyCredentialType="None" 
       realm="" /> 
      <message clientCredentialType="UserName" algorithmSuite="Default" /> 
      </security> 
     </binding> 
     <binding name="BasicHttpBinding_IGeocoderService" closeTimeout="00:01:00" 
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
      maxBufferSize="999999999" maxBufferPoolSize="524288" maxReceivedMessageSize="999999999" 
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
      useDefaultWebProxy="true"> 
      <readerQuotas maxDepth="32" maxStringContentLength="999999999" maxArrayLength="16384" 
       maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
      <security mode="None"> 
      <transport clientCredentialType="None" proxyCredentialType="None" 
       realm="" /> 
      <message clientCredentialType="UserName" algorithmSuite="Default" /> 
      </security> 
     </binding> 
     <binding name="PCMilerSoap" closeTimeout="00:01:00" openTimeout="00:01:00" 
      receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" 
      bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
      maxBufferSize="999999999" maxBufferPoolSize="524288" maxReceivedMessageSize="999999999" 
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
      useDefaultWebProxy="true"> 
      <readerQuotas maxDepth="32" maxStringContentLength="999999999" maxArrayLength="16384" 
       maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
      <security mode="None"> 
      <transport clientCredentialType="None" proxyCredentialType="None" 
       realm="" /> 
      <message clientCredentialType="UserName" algorithmSuite="Default" /> 
      </security> 
     </binding> 
     </basicHttpBinding> 
     <wsHttpBinding> 
     <binding name="WSHttpBinding_IGeocoderService" closeTimeout="00:01:00" 
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
      bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
      maxBufferPoolSize="524288" maxReceivedMessageSize="999999999" 
      messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
      allowCookies="false"> 
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
       maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
      <reliableSession ordered="true" inactivityTimeout="00:10:00" 
       enabled="false" /> 
      <security mode="Message"> 
      <transport clientCredentialType="Windows" proxyCredentialType="None" 
       realm="" /> 
      <message clientCredentialType="Windows" negotiateServiceCredential="true" 
       algorithmSuite="Default" establishSecurityContext="true" /> 
      </security> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="https://gis.customer.com/AddressVerification/Service/AddressVerificationService.svc" 
      binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAddressVerificationService" 
      contract="AddressVerificationService.IAddressVerificationService" 
      name="BasicHttpBinding_IAddressVerificationService" /> 
     <endpoint address="https://gis.customer.com/Geocoder/Service/GeocoderService.svc/ws" 
      binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IGeocoderService" 
      contract="GeocoderService.IGeocoderService" name="WSHttpBinding_IGeocoderService"> 
     <identity> 
      <dns value="localhost" /> 
     </identity> 
     </endpoint> 
     <endpoint address="https://gis.customer.com/Geocoder/Service/GeocoderService.svc/soap" 
      binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IGeocoderService" 
      contract="GeocoderService.IGeocoderService" name="BasicHttpBinding_IGeocoderService" /> 
     <endpoint address="http://hq-miler02.customer.net/MultiMiler/ALKWS/PCMiler.asmx" 
      binding="basicHttpBinding" bindingConfiguration="PCMilerSoap" 
      contract="PCMiler.PCMilerSoap" name="PCMilerSoap" /> 
    </client> 

将服务部署到负载均衡器后面的服务器时出现问题。当我尝试从WCFStorm或WebServiceStudio调用服务时,我收到消息“The provided URI scheme'https'is invalid; expected'http'。

服务本身的端点看起来很合适,但在开发中并测试版本的配置,客户端部分使用http而不是http,而在生产服务器上使用负载平衡器的https地址。

这看起来应该很明显,但我们错过了。给我们一个线索?

+0

有人吗?这个问题很愚蠢吗?我的问题太长还是不清楚? TMI? – 2010-09-07 15:31:08

+1

没问题。但这种情况下的经验很少。尝试还请问MSDN WCF论坛:http://social.msdn.microsoft.com/Forums/en-US/wcf/threads – 2010-09-07 19:38:00

+0

谢谢,拉迪斯拉夫。我这样做了,尽管在这种情况下没有帮助。事实证明,我们的网络安全性已经发生了变化,即使采用适当的配置也没有让任何事情发生如果您想让您的评论成为答案,我会将其标记为已接受。 – 2010-12-15 21:24:50

回答

0

我们在Windows网络负载平衡后面设置了wcf服务,没有任何问题(当然有一个,但它不是与NLB有关)

我认为这是与地址。 Web服务器通常不知道它在负载平衡器后面。所有看到的都是来自一个来源的负载均衡器的请求。你的绑定让它监听https,但除非负载平衡器通过https与网络服务器通信,这很少见,请求通过http传递,因此出现错误。

您需要将地址更改为http,或将负载平衡器设置为通过http与Web服务器通信。

0

因此,我迟到了派对,但我遇到了与调用F5后面的服务相同的问题。将您的客户端绑定安全性更改为传输而不是无。