如何WCF服务HTTPS绑定和terminalconfiguration与IIS中的负载平衡器?

我们有一个WCF服务,托pipe在一台12台机器上。 有一个负载平衡器是这些机器的网关。

现在该站点被设置为SSL; 就像用户通过使用带有https的URL访问它一样。 我知道这一点,寻址该网站的URL是https,但没有一个服务器有一个https绑定或被设置为需要SSL。 这使我相信,负载平衡器处理的HTTPS和从平衡器到服务器的连接是不encryption的(这发生在防火墙后面,所以没有biggie那里)。

我们遇到的问题是,当Silverlight客户端尝试访问WCF服务时,会出现“Not Found”错误。 我已经和我们的开发者机器一起build立了一个testing网站,并确保web.config中的绑定和端点与客户端一起工作。 在生产环境中似乎是这样,我们得到这个错误。

下面的web.config有什么问题吗? 我们应该如何设置https以不同的方式处理?

由于我已经尝试了使用端点和绑定的每个程序化解决scheme,所以我们目前处于这种状态。 我发现的解决scheme中没有一个以我们正在处理的方式处理负载平衡器。

Web.config服务模型信息:

<system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="TradePMR.OMS.Framework.Services.CRM.CRMServiceBehavior"> <serviceMetadata httpsGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> <behavior name="TradePMR.OMS.Framework.Services.AccountAggregation.AccountAggregationBehavior"> <serviceMetadata httpsGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> </serviceBehaviors> </behaviors> <bindings> <customBinding> <binding name="SecureCRMCustomBinding"> <binaryMessageEncoding /> <httpsTransport /> </binding> <binding name="SecureAACustomBinding"> <binaryMessageEncoding /> <httpsTransport /> </binding> </customBinding> <mexHttpsBinding> <binding name="SecureMex" /> </mexHttpsBinding> </bindings> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> <!--Defines the services to be used in the application--> <services> <service behaviorConfiguration="TradePMR.OMS.Framework.Services.CRM.CRMServiceBehavior" name="TradePMR.OMS.Framework.Services.CRM.CRMService"> <endpoint address="" binding="customBinding" bindingConfiguration="SecureCRMCustomBinding" contract="TradePMR.OMS.Framework.Services.CRM.CRMService" name="SecureCRMEndpoint" /> <!--This is required in order to be able to use the "Update Service Reference" in the Silverlight application--> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> <service behaviorConfiguration="TradePMR.OMS.Framework.Services.AccountAggregation.AccountAggregationBehavior" name="TradePMR.OMS.Framework.Services.AccountAggregation.AccountAggregation"> <endpoint address="" binding="customBinding" bindingConfiguration="SecureAACustomBinding" contract="TradePMR.OMS.Framework.Services.AccountAggregation.AccountAggregation" name="SecureAAEndpoint" /> <!--This is required in order to be able to use the "Update Service Reference" in the Silverlight application--> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> </system.serviceModel> </configuration> 

ServiceReferences.ClientConfig如下所示:

 <configuration> <system.serviceModel> <bindings> <customBinding> <binding name="StandardAAEndpoint"> <binaryMessageEncoding /> <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" /> </binding> <binding name="SecureAAEndpoint"> <binaryMessageEncoding /> <httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" /> </binding> <binding name="StandardCRMEndpoint"> <binaryMessageEncoding /> <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" /> </binding> <binding name="SecureCRMEndpoint"> <binaryMessageEncoding /> <httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" /> </binding> </customBinding> </bindings> <client> <endpoint address="https://Service2.svc" binding="customBinding" bindingConfiguration="SecureAAEndpoint" contract="AccountAggregationService.AccountAggregation" name="SecureAAEndpoint" /> <endpoint address="https://Service1.svc" binding="customBinding" bindingConfiguration="SecureCRMEndpoint" contract="CRMService.CRMService" name="SecureCRMEndpoint" /> </client> </system.serviceModel> </configuration> 

(这些地址是不重要的,因为这些地址是dynamic构build的,因此它们将指向开发人员的机器或生产服务器)

我正在回答这个问题,因为有些人知道这个应用程序正在生产,但是在这里没有看到答案。

在上述情况下,我们无法解决这个问题。 从客户端到负载平衡器的HTTPS是可以的。 问题出在负载平衡器采取连接并以未encryption的格式将其指向Web服务器。 这貌似打破了WCF协议。 客户端正在发送HTTPS通信,但服务器正在进行未encryption的通信。

我们通过所有SSL通信解决了这个问题。

最好的“解决scheme”是查看你的WCF服务是否不使用HTTP传输方法,并设置你的负载均衡器来通过这些通信不变。 然后,负载均衡器可以对网站生成的常规HTTPSstream量执行标准操作过程。

我没有testing过,因为我们的应用场景需要WCF服务与ASP.NET兼容。

希望别人可以用更多的信息来详细说明这一点。

我们遇到了同样的问题,并采用了微软开发人员提供的解决scheme。 该解决scheme是创build一个自定义的HttpTransport,覆盖从负载均衡器到服务器的SSL需求。