7

我启用了 https 绑定,但我的 WSDL 有 http 的肥皂地址。任何想法为什么?谢谢!

<wsdl:service name="XXXX"><wsdl:port name="BasicHttpBinding_XXXXService" binding="i0:BasicHttpBinding_XXXService">
    <soap:address location="http://dev-soa-app/XXXX/XXXX/XXXService.svc"/></wsdl:port>
</wsdl:service>

这是我的 web.config 文件:

<?xml version="1.0"?>
<configuration>

  <system.web>
    <customErrors mode="Off"/>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <configProtectedData>
    <providers>
      <add name="ConnStrings" type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" keyContainerName="ConnStrings" cspProviderName="" useMachineContainer="true" useOAEP="false"/>
    </providers>
  </configProtectedData>
  <connectionStrings configSource="ConnStrings\ConnStrings.config"/>
  <system.serviceModel>
    <services>
      <service name="XXXXService">
        <!-- Use a bindingNamespace to eliminate tempuri.org -->
        <endpoint address=""  name="XXXXService"
                  binding ="wsHttpBinding" bindingConfiguration="TransportSecurity"
                  bindingNamespace="WF.CT2.WebServices.XXXXService"
                  contract="WF.CT2.WebServices.XXXXService.SAMLService" />
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <bindings>
      <wsHttpBinding>
        <binding name="TransportSecurity">
          <security mode="Transport">
            <transport clientCredentialType="None"/>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpsGetEnabled="true" httpGetEnabled ="false" />
          <!-- 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>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>
4

2 回答 2

9

首先,您应该意识到serviceWSDL 元素中的 URL 只是一个提示。您的客户不应依赖此作为服务的正确地址。

其次,要意识到如果您的服务托管在 IIS 中,那么IIS会根据您在 IIS 中的绑定来确定放置在该元素中的地址。我怀疑您在托管服务的站点上同时启用了 HTTP 和 HTTPS。您通常可以通过在 IIS 管理器的 SSL 页面上设置“需要 SSL”属性来将其切换为仅 HTTPS。

于 2012-11-23T19:25:45.553 回答
0

从您的 Web.Config 中删除 httpGetEnabled ="false" 并保持 httpsGetEnabled="true" 原样(见下文)。

 <serviceBehaviors>
   <behavior>
     <serviceMetadata httpsGetEnabled="true" />
     <serviceDebug includeExceptionDetailInFaults="false"/>
 </behavior>
于 2017-12-26T19:31:41.170 回答