Hello,
I created a sharepoint application that exposes a wcf service but when I consume it via console application that runs on the same machine I get the following error:
System.ServiceModel.Security.MessageSecurityException: The HTTP request is unauthorized with client authentication scheme ‘Anonymous’.
The authentication header received from the server was ‘NTLM’. —> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
  at System.Net.HttpWebRequest.GetResponse()
  at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
  — End of inner exception stack trace —
Server stack trace:
  at System.ServiceModel.Channels.HttpChannelUtilities.ValidateAuthentication(HttpWebRequest request, HttpWebResponse response, WebException responseException, HttpChannelFactory`1 factory)
  at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory`1 factory, WebException responseException, ChannelBinding channelBinding)
  at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
  at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
  at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
  at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
  at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
  at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
  at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
  at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
  at WcfTestClient.ActioDev.IServiceWF.PingService()
  at WcfTestClient.ActioDev.ServiceWFClient.PingService()
  at WcfTestClient.Program.ActioDev()
 It works fine if the domain credentials are set as follows in the client:
var wCred = client.ClientCredentials.Windows.ClientCredential;
  wCred.Domain = domain;
  wCred.UserName = userName;
  wCred.Password = password;
but iI would like to remove the authentication so that the service is accessible to everyone.
I would appreciate it very much if someone showed me how to do it.
Thanks in advance.
ste22
Client app.config:
<system.serviceModel>
  <bindings>
     <basicHttpBinding>
        <binding name=”Std” />
     </basicHttpBinding>
  </bindings>
  <client>
     <endpoint address=”http://localhost/_vti_bin/ServiceWF/servicewf.svc”               Â
binding=”basicHttpBinding” bindingConfiguration=”Std” contract=”ActioDev.IServiceWF” name=”ActioDev” />
  </client>
</system.serviceModel>
Host service:
[BasicHttpBindingServiceMetadataExchangeEndpoint]
   [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
   [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)]
   public class ServiceWF : IServiceWF
   {
      public string PingService()
      {
          return “OK”;
      }
   }
   [ServiceContract(Namespace = “OW.WIO.ServiceWF.Operations”)]
   public interface IServiceWF
   {
      [OperationContract]
       string PingService();
   }
Is Anonymous Access enabled in IIS?
Also suggest looking at this and setting your transport type to none?
https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/wcf/transport-of-basichttpbinding