最近,我们将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地址元素中给出,如下图所示。我为糟糕的审查员工作道歉。