当我设置了Windows身份验证启用和匿名禁用在IIS中时,我得到以下错误。使Wcf服务集成Windows身份验证
主机 (“IntegratedWindowsAuthentication”)上配置的认证方案不允许 结合“basicHttpBinding的”(“匿名”)的那些配置。请确保将 SecurityMode设置为Transport或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>
请咨询..
您没有发布您的web.config ... – Tim 2013-03-07 06:59:30
现在就准备好了。请指教。 – user214471 2013-03-07 07:04:05
我在配置中看不到服务定义,只是客户端。如果这是您的服务的配置文件,并且您使用的是.NET 4.0以上版本,那么您很可能会得到一个默认终结点,这可能没有正确设置安全性。您还需要将您在配置文件中创建的绑定分配给您的服务。 – Tim 2013-03-07 07:07:05