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?

Dawid O
  • 6,091
  • 7
  • 28
  • 36

1 Answers1

14

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

<behavior name="...">
     ...
     <serviceAuthenticationManager authenticationSchemes="Basic"/>
     ...
</behavior>
Dawid O
  • 6,091
  • 7
  • 28
  • 36
  • 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: http://stackoverflow.com/a/19032453/151325 – goku_da_master Oct 22 '14 at 16:18
  • @Dawid O Where did you add this ? I am facing the same issue – ChiragMM Nov 10 '17 at 10:41