gpt4 book ai didi

c# - WCF 服务 web.config 调整以更改生成的 wdl

转载 作者:太空宇宙 更新时间:2023-11-03 13:39:53 25 4
gpt4 key购买 nike

我的 wcf 服务遵循以下负载平衡结构:

公共(public) (https) -> F5 LB (http) -> node1/node2。

我在 http 方案上公开服务,F5 LB 负责 ssl 卸载。由于我的服务公开为http,通过F5 LB生成的wsdl包含基于http的url如下:

我的负载均衡服务网址:

https://myservice.mydomain.com/service1.svc

生成的服务页面是:

MyService Service

You have created a service.

To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:

svcutil.exe http://myservice.mydomain.com/service1.svc?wsdl

You can also access the service description as a single file:

http://myservice.mydomain.com/service1.svc?singleWsdl

如您所见,生成的页面具有从应用程序节点公开的 http url。由于 F5 LB 将服务公开为 https,因此它不允许上述 http url,并且来自客户端的请求被弹跳。

现在,我们能否调整我的服务 web.config 以在 http 方案上公开服务,但让 wsdl 指向 https url,以便来自 F5 LB 的 wsdl 之上生成的 url 也是 https,客户端将在 https 上工作,来自 LB 的请求将在我的服务处理的 http 上提供服务?

最佳答案

在不完全了解您的配置/环境的情况下,我会建议一些可以帮助您解决问题的选项:

  • 在您的服务中同时提供 http 和 https 基地址仅通过 https 配置和启用元数据 ''
  • 实现一个单独的 mex 端点(而不是使用 serviceMetadata),这样可以更好地控制元数据端点(即不同的 address 和/或 listenUri)
  • 使用 System.ServiceModel.Description.IWsdlExportExtension 控制呈现的服务元数据

引用资料:
What was the difference between WSDL & Mex Endpoint in WCF
http://blogs.msdn.com/b/saurabs/archive/2012/04/27/http-get-v-s-mex-end-point.aspx
http://msdn.microsoft.com/en-us/library/aa717040.aspx

关于c# - WCF 服务 web.config 调整以更改生成的 wdl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26908547/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com