2014-09-02 31 views
4

上配置的身份驗證方案我在這裏遵循教程:http://allen-conway-dotnet.blogspot.co.uk/2012/07/using-basic-authentication-in-rest.html?_sm_au_=iFVksVM0H8QrkntP,以實現WCF服務中的用戶身份驗證,但是我得到以下錯誤:在主機('匿名')上配置的身份驗證方案不允許在綁定'WebHttpBinding'('Basic')

 
The authentication schemes configured on the host ('Anonymous') do not allow those configured 
on the binding 'WebHttpBinding' ('Basic'). Please ensure that the SecurityMode is set to 
Transport or TransportCredentialOnly. Additionally, this may be resolved by changing the 
authentication schemes for this application through the IIS management tool, through the 
ServiceHost.Authentication.AuthenticationSchemes property, in the application configuration 
file at the element, by updating the ClientCredentialType property on the binding, or by 
adjusting the AuthenticationScheme property on the HttpTransportBindingElement. 

我曾嘗試在項目中禁用「匿名身份驗證」,但然後我得到的是錯誤401 - 未經授權。沒有提示輸入用戶名和密碼。有誰知道爲什麼會出現這個問題,以及如何解決它?

回答

11

我終於設法通過將擺脫這個問題:

<behavior name="..."> 
    ... 
    <serviceAuthenticationManager authenticationSchemes="Basic"/> 
    ... 
</behavior> 
+2

這讓我更接近,但我仍然得到了認證錯誤(不同的)。我最終直接從IIS Express配置文件啓用基本身份驗證。只需按照此解決方案中的步驟:http://stackoverflow.com/a/19032453/151325 – 2014-10-22 16:18:31

+0

@Dawid O你在哪裏添加這個?我面臨同樣的問題 – ChiragMM 2017-11-10 10:41:11

相關問題