How to use Basic Authentication ?

Topics: Web Api
Nov 29, 2011 at 12:36 AM
Edited Nov 29, 2011 at 12:37 AM

Hello, everyone, I want to enable Basic Authentication and disable Anonymous Authentication in IIS, but when I called the restful web services, it showed a message like this:Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.

Hope you can help me. 

Thanks in advance!


Coordinator
Nov 29, 2011 at 5:08 AM

You need to configure the WCF binding for basic auth.

Something like this:

binding.Security.Mode = SecurityMode.Transport;

binding.Security.Transport.ClientCredentialType =

HttpClientCredentialType.Basic;

You can access the binding security settings by configuring a Security action on HttpConfiguration.

Daniel Roth

Nov 29, 2011 at 8:28 AM

Thank you, danroth!