【问题标题】:The authentication schemes configured on the host ('Basic') do not allow those configured on the binding 'BasicHttpBinding'在主机('Basic')上配置的身份验证方案不允许在绑定'BasicHttpBinding'上配置的那些
【发布时间】:2016-02-21 14:29:06
【问题描述】:

错误

主机上配置的身份验证方案(“基本”)不 允许在绑定“BasicHttpBinding”上配置的那些 ('匿名的')。请确保将 SecurityMode 设置为 Transport 或 TransportCredentialOnly。此外,这可能是 通过更改此应用程序的身份验证方案解决 通过 IIS 管理工具,通过 ServiceHost.Authentication.AuthenticationSchemes 属性,在 应用程序配置文件在 元素,通过更新绑定上的 ClientCredentialType 属性, 或通过调整 AuthenticationScheme 属性 HttpTransportBindingElement。

你知道 web.config 的问题在哪里吗?我尝试使用 Windows 凭据通过基本身份验证登录 WCF。

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
    <authentication mode="Windows" />
    <customErrors mode="Off"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="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>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    <bindings>
      <basicHttpBinding>
        <binding name="basicEndpoint">
          <security mode="Transport" >
            <transport clientCredentialType="Basic"
                       proxyCredentialType="None"
                       realm="" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <add name="BasicAuthHttpModule"
        type="Wt.BasicAuthHttpModule, Wt"/>
    </modules>
  </system.webServer>

</configuration>

【问题讨论】:

    标签: c# asp.net wcf


    【解决方案1】:

    您似乎正在使用Simplified Configuration for WCF Services

    如果您没有明确指定端点服务及其绑定配置,WCF 将执行以下操作:

    • 它将默认绑定与使用的协议(方案)相关联。
    • 它将加载绑定类型的默认绑定配置。

    协议映射见此说明Simplified Configuration

    默认 bindingConfiguration 没有名称,因此如果您为 basicHttpBinding 配置指定特定名称,则不会覆盖默认绑定配置。应该是

    <basicHttpBinding>
        <binding>
            <security mode="Transport">
                <transport clientCredentialType="Basic"
                    proxyCredentialType="None"
                    realm="" />
            </security>
        </binding>
    </basicHttpBinding>
    

    【讨论】:

      猜你喜欢
      • 2014-10-26
      • 2013-12-09
      • 1970-01-01
      • 2016-02-03
      • 2015-06-21
      • 2013-07-29
      • 1970-01-01
      • 2014-11-16
      • 1970-01-01
      相关资源
      最近更新 更多