Reputation: 2154
I am generating a WCF Web Service Reference reference.cs
in a .NET Standard 2.0 project then using it from a .NET 4.7.1 project but I get "Could not establish secure channel for SSL/TLS with authority"
If I generate it usingAdd Service Reference
aside from visual studio 2015. I get a similar reference.cs class and if I copy it in my .NET standard 2.0 project that would work but I lose the Async call implementation of the WCF Web service. Is there any way to make this work ?
Upvotes: 2
Views: 5881
Reputation: 335
Make sure you configure the Bindings. They are in the app.config in a .net framework project but should be encapsuled in a BasicHttpBinding
in .NET Standard/.NET Core.
That way you can specify the security settings as needed:
binding.Security.Mode = BasicHttpSecurityMode.Transport;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;
From Nuget package System.ServiceModel.Http:
namespace System.ServiceModel
{
public class BasicHttpBinding : HttpBindingBase
{
public BasicHttpBinding();
public BasicHttpBinding(BasicHttpSecurityMode securityMode);
public BasicHttpSecurity Security { get; set; }
public override IChannelFactory<TChannel> BuildChannelFactory<TChannel>(BindingParameterCollection parameters);
public override BindingElementCollection CreateBindingElements();
}
}
Upvotes: 1