Receiving the following error message regardless of basicHttpBinding or wsHttpBinding in .net core 3.1:
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+<>c__DisplayClass1_0.<CreateGenericTask>b__0(IAsyncResult asyncResult)
this is the 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();
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?