【问题标题】:Https binding in WCF throws errorWCF 中的 Https 绑定引发错误
【发布时间】:2012-06-27 08:22:44
【问题描述】:

我有一个 WCF 服务需要使用使用 SSL 的 basicHttpBinding 进行托管。 因此,我的团队安装了启用匿名身份验证的 SSL 证书,并在 IIS 中提供了硬编码的用户名和密码。 我试着给这个绑定

 <binding name="SecurityByTransport">
               <security mode="Transport">
                 <transport clientCredentialType="Windows" />
                </security>
            </binding>   

但它仍然不起作用。我收到此错误“找不到与绑定 BasicHttpBinding 的端点的方案 http 匹配的基地址。注册的基地址方案是 [https]。”

ServiceModel 部分:

 <system.serviceModel>
<diagnostics>
  <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtTransportLevel="true" />
</diagnostics>
<bindings>
  <customBinding>
    <binding name="netTcp">
      <binaryMessageEncoding>
        <readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647" maxDepth="64" />
      </binaryMessageEncoding>
      <security authenticationMode="UserNameOverTransport" />
      <windowsStreamSecurity />
      <tcpTransport portSharingEnabled="true" maxBufferPoolSize="52428800" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
    </binding>
  </customBinding>

  <basicHttpBinding>
    <binding name="Https">
      <security mode="Transport">

      </security>
    </binding>
  </basicHttpBinding>

</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name ="Https">

      <serviceMetadata httpsGetEnabled="true"/>

      <serviceDebug includeExceptionDetailInFaults="false"/>
      <serviceCredentials>
        <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Asi.Soa.ServiceModelEx.NullUserNamePasswordValidator, Asi.Soa.ServiceModelEx" />
        <clientCertificate>
          <authentication certificateValidationMode="None" />
        </clientCertificate>
      </serviceCredentials>
      <serviceAuthorization principalPermissionMode="Custom">
        <authorizationPolicies>
          <add policyType="Asi.Soa.ServiceModelEx.ClaimsAuthorizationPolicy, Asi.Soa.ServiceModelEx" />
        </authorizationPolicies>
      </serviceAuthorization>
      <exceptionShielding/>
    </behavior>


  </serviceBehaviors>
  <endpointBehaviors>
    <behavior name="SoapBehavior">

    </behavior>
    <behavior name="RestBehavior">

    </behavior>
    <behavior name="AjaxBehavior">
      <enableWebScript />
    </behavior>
  </endpointBehaviors>
</behaviors>
<services>


  <service name="Asi.Soa.Core.Services.EntityService" >
    <endpoint address="https://10.42.150.122/imis15/EntityService.svc" binding="basicHttpBinding" contract="Asi.Soa.Core.ServiceContracts.IEntityService"
       bindingConfiguration="Https" />
  </service>

</services>

任何帮助将不胜感激。

谢谢

【问题讨论】:

  • 你能完全发布 serviceModel 部分来帮助你吗?
  • 用 serviceModel 部分 Rajesh 编辑了帖子。任何建议都会非常有帮助。
  • 您在 IIS 上的何处托管您的服务?

标签: wcf wcf-security


【解决方案1】:

尝试添加到服务行为设置

      <serviceMetadata httpsGetEnabled="true"/>

您还应该检查端点是否有设置

      bindingConfiguration="SecurityByTransport"

【讨论】:

  • 嗨 paramosh,请看一下 serviceModel 部分,net.tcp 绑定工作正常,我需要同样的方法来处理 basichttpBinding 使我能够使用 https
  • 通过添加 HttpsGetEnabled=true 和 HttpGetEnabled = false 解决它;谢谢大家。
【解决方案2】:

如果您在 IIS 中托管服务,请尝试从站点绑定中删除 http 绑定。

HTH

【讨论】:

    【解决方案3】:

    由于您在 IIS 上使用 Web 服务,考虑到您使用的是 SSL 证书,请使用 HTTPS 绑定。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-01-14
      • 1970-01-01
      • 1970-01-01
      • 2012-01-01
      • 1970-01-01
      • 2016-03-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多