title: .net core calling wcf service - SecurityAccessDeniedException: The security token could not be authenticated or authorized
body: <p>Receiving the following error message regardless of basicHttpBinding or wsHttpBinding in .net core 3.1:</p>
  
  <pre><code> SecurityAccessDeniedException: The security token could not be authenticated or authorized
   System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, string action, MessageVersion version, FaultConverter faultConverter)
   System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ref ProxyRpc rpc)
   System.ServiceModel.Channels.ServiceChannel.EndCall(string action, object[] outs, IAsyncResult result)
   System.ServiceModel.Channels.ServiceChannelProxy+TaskCreator+&lt;&gt;c__DisplayClass1_0.&lt;CreateGenericTask&gt;b__0(IAsyncResult asyncResult)
  </code></pre>
  
  <p>this is the code: </p>
  
  <pre><code>var binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
  binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;  
  var address = new System.ServiceModel.EndpointAddress("soapendpoint");
  var client = new Client(binding, address);
  
  var cf = client.ChannelFactory;
  cf.Credentials.UserName.UserName = username;
  cf.Credentials.UserName.Password = password;
  var channel = cf.CreateChannel();
  
  var response = channel.GetPatientAsync();
  </code></pre>
  
  <p>i am not after a solution but some pointers on either what am i doing wrong here or what else should i try to figure out?</p>