當我設置了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