【问题标题】:Moving WCF service to IIS6 with SSL enabled在启用 SSL 的情况下将 WCF 服务移动到 IIS6
【发布时间】:2016-10-03 20:14:14
【问题描述】:

我在未启用 SSL 的服务器上运行我的 WCF 服务,现在我将它移到启用 SSL 的服务器上,但出现以下错误:

找不到与绑定 BasicHttpBinding 的端点的方案 http 匹配的基地址。注册的基地址方案是 [https]。

以下是我的设置:

<bindings>
  <basicHttpBinding>
    <binding name="basicHTTP">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows">
        </transport>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<services>
  <service behaviorConfiguration="basicBehavior" name="ProjectName.MyService">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHTTP" contract="ProjectName.IMyService"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="basicBehavior">
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

我该如何解决这个错误?

【问题讨论】:

    标签: wcf iis-6


    【解决方案1】:

    您需要为 basicHttps 定义一个绑定。这是一个适用于 SSL 的非常简单的设置:

    <system.serviceModel>
        <bindings>
          <basicHttpsBinding>
            <binding name="BasicHttpBinding_IMyService" />
          </basicHttpsBinding>
        </bindings>
    
        <client>
          <endpoint
            name="BasicHttpBinding_IMyService"
            address="https://MyURL/MyService.svc/soap/"
            binding="basicHttpsBinding"
            bindingConfiguration="BasicHttpBinding_IMyService"
            contract="ClientServiceReference.IMyService" />
        </client>
    
      </system.serviceModel>
    

    注意:需要定义endpoint,其URL为https

    另外,请确保在生产环境中,您不会将异常详细信息发送回调用者(这将被视为系统中的安全漏洞,因为异常可能会向黑客泄露太多信息)。您必须更改此行:

    <serviceDebug includeExceptionDetailInFaults="false"/>
    

    【讨论】:

    • 查看我在原始问题中发布的 web.config 文件
    【解决方案2】:

    通过将安全模式指定为 Transport 并使用 webHttpBinding 解决了问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-06-08
      • 2012-10-22
      • 1970-01-01
      • 2019-07-27
      • 2015-03-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多