I have added a service reference with Visual studio WCF connected service.
When i try to consume i receive the exception that the credentials are not found.
I´ve been able to consume this service in asp.net mvc but to make this work i made a trick to overriding the headers in the request:
public class AgendasWs2 : CatalogosAgendasWS_A { protected override System.Net.WebRequest GetWebRequest(Uri uri) { HttpWebRequest request; request = (HttpWebRequest)base.GetWebRequest(uri); if (PreAuthenticate) { NetworkCredential networkCredentials = Credentials.GetCredential(uri, "Basic"); if (networkCredentials != null) { byte[] credentialBuffer = new UTF8Encoding().GetBytes(networkCredentials.UserName + ":" + networkCredentials.Password); request.Headers["Authorization"] = "Basic " + Convert.ToBase64String(credentialBuffer); } else { throw new ApplicationException("No network credentials"); } } return request; } }
As you can see i override the headers before sendind the request.
The service has a Preemptive authentication type
I dont have any idea of making this in asp.net core.
Any help :)