最近,我们将 HTTPS 添加到通过 REST 和 SOAP 端点公开的 WCF 服务之一。
当我们进行此修改时,SOAP 端点遇到了我无法找到修复的问题。
我现在遇到的问题是,当使用 HTTP 端点时,WSDL 中给出的 SOAP 地址指向本地地址。这不允许通过 HTTP 使用服务,并且只能使用 HTTPS。
相关部分的 web.config 如下:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpsBinding">
<security mode="Transport"/>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="MyServiceBehavior"
name="Some.Path.To.MyService">
<endpoint address="" binding="basicHttpBinding"
bindingConfiguration="basicHttpsBinding"
contract="Some.Path.To.IMyService"/>
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="PingPostServiceBehavior">
<serviceThrottling maxConcurrentInstances="800"
maxConcurrentCalls="800"
maxConcurrentSessions="800"/>
<!--<useRequestHeadersForMetadataAddress/>-->
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
当我转到 PRODUCTION HTTP WSDL 地址时,本地地址在soap 地址元素中给出,如下图所示。我为糟糕的审查员工作道歉。