Here is an article described how to implement this.
How to: Use basicHttpBinding with Windows Authentication and TransportCredentialOnly in WCF from Windows Forms
http://msdn.microsoft.com/en-us/library/ff648505.aspx
These two blogs written by well-known WCF experts described the same scenario as well.
Preventing Anonymous Access
http://blogs.msdn.com/b/drnick/archive/2007/03/23/preventing-anonymous-access.aspx
http://blogs.msdn.com/b/wenlong/archive/2006/05/18/600603.aspx
However, customer got follow error using .Net 4.0 even follow the exactly same steps.
[NotSupportedException: Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.]
System.ServiceModel.Activation.HostedAspNetEnvironment.ValidateHttpSettings(String virtualPath, Boolean isMetadataListener, Boolean usingDefaultSpnList, AuthenticationSchemes& supportedSchemes, ExtendedProtectionPolicy& extendedProtectionPolicy, String& realm) +194425
System.ServiceModel.Channels.HttpChannelListener.ApplyHostedContext(String virtualPath, Boolean isMetadataListener) +104
System.ServiceModel.Channels.HttpTransportBindingElement.BuildChannelListener(BindingContext context) +156
System.ServiceModel.Channels.Binding.BuildChannelListener(Uri listenUriBaseAddress, String listenUriRelativeAddress, ListenUriMode listenUriMode, BindingParameterCollection parameters) +166
Read more: AsiaTech: Microsoft APGC Internet Developer Support Team
QR: