为什么我的serviceAuthenticationManagerType不会被调用进行基本身份验证?

时间:2014-04-11 14:43:11

标签: asp.net wcf

我正在使用WCF OData服务并尝试使用基本身份验证。当我在Web浏览器中浏览我的OData服务时,我会收到用户名/密码提示。但是当我输入用户名和密码时,我的自定义serviceAuthenticationManagerType不会被调用,登录失败。我有错误的配置吗?

  <system.serviceModel>
<bindings>
  <webHttpBinding>
    <binding name="basicHttp">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Basic"/>
      </security>
    </binding>
  </webHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="dataServiceBehavior">
      <!-- To avoid disclosing metadata information, set the values below to false 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="true" />
      <serviceAuthorization principalPermissionMode="Custom">
        <authorizationPolicies>
          <add policyType="WcfResearch.AuthorizationManagers.WcfResearchAuthorizationPolicy, WcfResearch.AuthorizationManagers" />
        </authorizationPolicies>
      </serviceAuthorization>
      <serviceAuthenticationManager authenticationSchemes="Basic" serviceAuthenticationManagerType="WcfResearch.AuthorizationManagers.WcfResearchAuthenticationManager, WcfResearch.AuthorizationManagers"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<protocolMapping>
  <add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
  <service name="WcfResearch.WcfDataService1" behaviorConfiguration="dataServiceBehavior">
    <endpoint binding="webHttpBinding" bindingConfiguration="basicHttp" contract="System.Data.Services.IRequestHandler" />
  </service>
</services>

0 个答案:

没有答案