首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >使Wcf服务成为IntegratedWindowsAuthentication

使Wcf服务成为IntegratedWindowsAuthentication
EN

Stack Overflow用户
提问于 2013-03-07 14:57:37
回答 8查看 47.1K关注 0票数 23

当我在IIS中将Windows身份验证启用和匿名设置为禁用时,我收到以下错误。

匿名主机上配置的身份验证方案('IntegratedWindowsAuthentication')不允许绑定'BasicHttpBinding‘(’

‘)上配置的身份验证方案。请确保将SecurityMode设置为传输或TransportCredentialOnly。此外,可以通过以下方式解决此问题:通过IIS管理工具更改此应用程序的身份验证方案、通过ServiceHost.Authentication.AuthenticationSchemes属性、在应用程序配置文件中的元素处、通过更新绑定的ClientCredentialType属性或通过调整HttpTransportBindingElement的AuthenticationScheme属性。

我的Wcf服务的web.config如下所示...

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpEndpointBinding">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint binding="basicHttpBinding" 
        bindingConfiguration="BasicHttpEndpointBinding"
        contract="Test.IService1" name="BasicHttpEndpoint" />
    </client>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceAuthenticationManager 
             authenticationSchemes="IntegratedWindowsAuthentication"/>
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="basicHttpBinding" scheme="http" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
         multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="true"/>
  </system.webServer>
</configuration>

请指教..

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15264969

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档