【发布时间】:2015-04-09 18:33:37
【问题描述】:
我在 VS 2010 .NET 4.0 中有一个 Wcf 服务。
IIS 站点是虚拟目录。
我尝试配置它并使用 https 访问它
但我得到错误
Could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding. Registered base address schemes are [http].
或
Could not find a base address that matches scheme https for the endpoint with binding BasicHttpBinding. Registered base address schemes are [http].
谷歌,我看到了几个关于配置的替代方案:serviceMetadata、绑定、baseAddresses、..
我尝试了不同的配置,但我得到了同样的错误:
服务元数据
<serviceMetadata httpGetEnabled="false or true" httpsGetEnabled="true" />
绑定
我用<security mode="Transport">
<bindings>
<basicHttpBinding>
<binding name="SecureTransportOnly">
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
</security>
</binding>
<binding name="NoSecure">
<security mode="None"><transport clientCredentialType="None"/></security>
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="SecureTransportOnly">
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
</security>
</binding>
</wsHttpBinding>
</bindings>
端点
<endpoint
address=""
binding="basicHttpBinding"
bindingConfiguration="SecureTransportOnly"
name="xxxActualServiceEndPoint"
bindingNamespace="https://pruebaslba.xxxx.net/ServicioPyS"
contract="IxxxActualService">
墨西哥
<endpoint address="mex" binding="mexHttpBinding o mexHttpsBinding" contract="IMetadataExchange"/>
我也试过了:
<!--<host>
<baseAddresses>
<add baseAddress="https://pruebaslba.xxxx.net o https://pruebaslba.xxxx.net/ServicioPyS"/>
</baseAddresses>
</host>-->
<!--<identity>
<dns value="localhost" />
</identity>-->
我想,我尝试了几乎在论坛中找到的配置。我不知道解决方案。
更新 我得到了更多关于它的信息。 该网站位于 2 个服务器中(PreProduction 环境):preiis01 和 preiis02。 SSL 未启用。
我可以访问http://preiis01/ServicioPyS/Service.svc?wsdl http一切正常。
https://pruebaslba.xxxx.net/ServicioPyS/Service.svc?wsdl 是关于 NLB 的公共 url(负载平衡,我认为是 F5)。在 NLB 中,配置了 SSL。我不知道更多信息,只有IT部门有所有信息。
问题在于 WSDL
http://preiis01/ServicioPyS/Service.svc?wsdl
<wsdl:service name="ActualService">
<wsdl:port name="ActualServiceEndPoint"binding="i0:ActualServiceEndPoint">
<soap:addresslocation="http://preiis01/ServicioPyS/Service.svc/Service.svc" />
</wsdl:port>
</wsdl:service>
NLB 中的 url WSDL 有 soap:address location 部分的问题,并且没有正确生成(设置 http,而不是 https)
https://pruebaslba.xxxx.net/ServicioPyS/Service.svc?wsdl
<wsdl:service name="ActualService">
<wsdl:port name="ActualServiceEndPoint"binding="i0:ActualServiceEndPoint">
<soap:addresslocation="http://pruebaslba.xxxx.net/ServicioPyS/Service.svc/Service.svc" />
</wsdl:port>
</wsdl:service>
快速解决方案是手动修改 WSDL(单个文件)并在 soap:addresslocation 部分中设置 https,在新 url https://pruebaslba.xxxx.net/ServicioPyS/WSDL/ServiceWsdlModificado.Single.wsdl
https://pruebaslba.xxxx.net/ServicioPyS/WSDL/ServiceWsdlModificado.Single.wsdl
<wsdl:service name="ActualService">
<wsdl:port name="ActualServiceEndPoint"binding="tns:ActualServiceEndPoint">
<soap:addresslocation="https://pruebaslba.xxxx.net/ServicioPyS/Service.svc/Service.svc"/>
</wsdl:port>
</wsdl:service>
我认为,还有另一种具有良好实践的良好解决方案。我不知道。
IIS 中的网站没有启用 SSL,而 NLB 有 SSL。
可能是“SSL pass-through”,我不知道
http://blog.tonysneed.com/2012/06/18/building-scalable-and-secure-wcf-services/
有什么建议吗?
【问题讨论】:
-
您是否在 IIS 中为您的网站添加了 https 绑定?
-
@Thuan SSL 未在网站 IIS 中启用。仅在 NLB F5 中。也许有用的 SSL 直通,我不知道。站点绑定是 *http 主机名:pruebaslba.xxxx.net 和端口 80 是关于 NLB(负载平衡,F5)的 url ***
标签: c# wcf https wcf-endpoint