WCF http服务通过https负载均衡器 [英] WCF http service via https load balancer

查看:142
本文介绍了WCF http服务通过https负载均衡器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可以通过http端点访问的WCF Web服务。现在,该服务应通过https与负载均衡器一起发布。客户端是通过svcutil.exe在.Net中创建的,但Java客户端也需要WSDL。

I have a WCF webservice that can be accessed via a http endpoint. Now, this service shall be published with a load balancer via https. Clients are created in .Net via svcutil.exe but the WSDL is also needed for a Java client.

我的理解是:


  • 在内部,webservice是一个http服务,不需要更改任何内容。地址为 http ://myserver.com/example.svc with WSDL ..?wsdl

  • 外部服务必须显示为https服务地址 https :// loadbalancer.com/example.svc和WSDL ..?wsdl

  • Internally the webservice is a http service and nothing needs to be changed. The address is http://myserver.com/example.svc with WSDL ..?wsdl
  • Externally the service has to show up as a https service with address https://loadbalancer.com/example.svc and WSDL ..?wsdl

来自其他地方帖子我了解到负载均衡器问题可以通过以下行为配置来解决:

From other posts I have learned that the load balancer problem can be solved with following behaviour configuration:

    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <useRequestHeadersForMetadataAddress>
        <defaultPorts>
          <!-- Use your own port numbers -->
          <add scheme="http" port="81" />
          <add scheme="https" port="444" />
        </defaultPorts>
      </useRequestHeadersForMetadataAddress>
    </behavior>

使用此解决方法我将两个URL解析到服务帮助页面,但调用
https :// loadbalancer.com/example.svc页面将我引导至 http :// loadbalancer.com/example.svc?wsdl。当我用https替换http时,我可以加载wsdl,但它的所有内部链接都是 http ,而不是 https

Using this workaround I get both URLs resolved to the services help page, but calling https://loadbalancer.com/example.svc the page leads me to http://loadbalancer.com/example.svc?wsdl. When I replace the http by https I can load the wsdl but it has all internal links as http and not https.

尝试切换httpsGetEnabled =true会引发我很多与https相关的问题,我不知道这是否可以帮助我,因为我的服务器本身只知道http。

Trying to switch httpsGetEnabled="true" leads me to a lot of https related issues and I don't know if this can help me as my server itself only knows http.

所以,我的问题是负载均衡URL的https。我可以告诉WCF它应该在WSDL元数据而不是http中显示https吗?我该怎么办?

So, my problem is the https for the load balanced URL. Can I tell WCF that it shall show https in the WSDL meta data instead of http and how can I do this?

推荐答案

否,无法告诉WCF在WSDL元数据中显示https而不是http。
我们的解决方案是,创建http和https endpointbindings,检查传入请求是否为http或https,传入请求类型确定将使用哪些端点绑定。

no, no way to tell the WCF to show the https in WSDL meta data instead of http. our solution is, create both http and https endpointbindings, check if the incoming request is http or https, the incoming request type determine which endpointbindings will be used.

这篇关于WCF http服务通过https负载均衡器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆