The authentication schemes configured on the host ('Anonymous') do not allow those configured on the binding 'WebHttpBinding' ('Basic')
Asked Answered
N

1

6

I was following the tutorial here: http://allen-conway-dotnet.blogspot.co.uk/2012/07/using-basic-authentication-in-rest.html?_sm_au_=iFVksVM0H8QrkntP, to implement User Authentication in WCF service but I get the following error:

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.

I did try disabling "Anonymous Authentication" in the project but then all I get is Error 401 - Unauthorized. No prompt to enter username and password ever shows up. Does anyone know why this problem might be occurring and how to fix it?

Nitrogenous answered 2/9, 2014 at 14:46 Comment(0)
N
14

I did finally manage to get rid of the problem by adding:

<behavior name="...">
     ...
     <serviceAuthenticationManager authenticationSchemes="Basic"/>
     ...
</behavior>
Nitrogenous answered 3/9, 2014 at 17:28 Comment(2)
This got me closer, but I was still getting an authentication error (a different one). I ended up enabling basic authentication directly from the IIS Express config file. Just follow the steps in this solution: https://mcmap.net/q/981387/-how-to-enable-windows-authentication-on-asp-net-development-serverQuadricycle
@Dawid O Where did you add this ? I am facing the same issueEccles

© 2022 - 2024 — McMap. All rights reserved.